DATAJPA-405 - Guard against null predicates on query creation.
We now only call CriteriaQuery.where(…) if the predicate we handle is a non-null value. Adapted Jpa(Count)QueryCreator accordingly.
This commit is contained in:
@@ -1136,6 +1136,20 @@ public class UserRepositoryTests {
|
||||
assertThat(repository.findByActiveTrue().size(), is(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAJPA-405
|
||||
*/
|
||||
@Test
|
||||
public void executesFinderWithOrderClauseOnly() {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
List<User> result = repository.findAllByOrderByLastnameAsc();
|
||||
|
||||
assertThat(result, hasSize(4));
|
||||
assertThat(result, contains(secondUser, firstUser, thirdUser, fourthUser));
|
||||
}
|
||||
|
||||
private Page<User> executeSpecWithSort(Sort sort) {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
@@ -283,4 +283,9 @@ public interface UserRepository extends JpaRepository<User, Integer>, JpaSpecifi
|
||||
@Modifying
|
||||
@Query("update #{#entityName} u set u.active = :activeState where u.id in :ids")
|
||||
void updateUserActiveState(@Param("activeState") boolean activeState, @Param("ids") Integer... ids);
|
||||
|
||||
/**
|
||||
* @see DATAJPA-405
|
||||
*/
|
||||
List<User> findAllByOrderByLastnameAsc();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user