DATAJPA-510 - Fix regression when sorting by property of associated object.

The main problem was a bug in querydsl 3.3.2 that has been resolved resolved in querydsl 3.3.3 to which we just updated in in spring-data-build/#70.

Cleaner usage of querydsl API and less brittle casting. Added test case for sorting by nested association property that is wrapped in a function, e.g. lower(…).

Original pull request: #87.
This commit is contained in:
Thomas Darimont
2014-04-07 14:42:51 +02:00
committed by Oliver Gierke
parent a39f69c0a6
commit 4d63856dde
2 changed files with 22 additions and 2 deletions

View File

@@ -1281,6 +1281,24 @@ public class UserRepositoryTests {
assertThat(page.getContent().get(3), is(firstUser));
}
/**
* @see DATAJPA-510
*/
@Test
public void sortByNestedAssociationPropertyWithSortOrderIgnoreCaseInPageable() {
firstUser.setManager(thirdUser);
thirdUser.setManager(fourthUser);
flushTestUsers();
Page<User> page = repository.findAll(new PageRequest(0, 10, //
new Sort(new Sort.Order(Direction.ASC, "manager.manager.firstname").ignoreCase())));
assertThat(page.getContent(), hasSize(4));
assertThat(page.getContent().get(3), is(firstUser));
}
/**
* @see DATAJPA-496
*/