DATAJPA-420 - Fixed count projection for manual queries with projections.

Original pull request: #52.
This commit is contained in:
Komi Serge Innocent
2013-11-14 15:37:33 +00:00
committed by Oliver Gierke
parent ae10332b18
commit a0a98dfc57
2 changed files with 11 additions and 1 deletions

View File

@@ -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));
}