DATAJPA-420 - Fixed count projection for manual queries with projections.
Original pull request: #52.
This commit is contained in:
committed by
Oliver Gierke
parent
ae10332b18
commit
a0a98dfc57
@@ -30,6 +30,7 @@ import org.springframework.data.domain.Sort;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Komi Innocent
|
||||
*/
|
||||
public class QueryUtilsUnitTests {
|
||||
|
||||
@@ -263,6 +264,14 @@ public class QueryUtilsUnitTests {
|
||||
assertCountQuery("select a.b from A a", "select count(a.b) from A a");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-420
|
||||
*/
|
||||
@Test
|
||||
public void createsCountQueryForScalarSelects() {
|
||||
assertCountQuery("select p.lastname,p.firstname from Person p", "select count(p) from Person p");
|
||||
}
|
||||
|
||||
private void assertCountQuery(String originalQuery, String countQuery) {
|
||||
assertThat(createCountQueryFor(originalQuery), is(countQuery));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user