DATAJPA-375 - Fixed application of sort to queries with existing order by.
Improved existingin order by detection to detect the existing clause independent of the case. Before we only detected lower case "order by" expressions.
This commit is contained in:
@@ -244,6 +244,17 @@ public class QueryUtilsUnitTests {
|
||||
"select count(distinct m.genre) from Media m where m.user = ?1");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-375
|
||||
*/
|
||||
@Test
|
||||
public void findsExistingOrderByIndependentOfCase() {
|
||||
|
||||
Sort sort = new Sort("lastname");
|
||||
String query = applySorting("select p from Person p ORDER BY p.firstname", sort, "p");
|
||||
assertThat(query, endsWith("ORDER BY p.firstname, p.lastname asc"));
|
||||
}
|
||||
|
||||
private void assertCountQuery(String originalQuery, String countQuery) {
|
||||
assertThat(createCountQueryFor(originalQuery), is(countQuery));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user