DATAJPA-858 - Fixed collection contains handling for nested path traversals.
Previously the first property was checked for being a collection to trigger collection contains handling. This is wrong for nested property traversals as they might end up in a String for which a like binding has to be applied then. We're now inspecting the leaf property for being a collection to trigger that special binding.
This commit is contained in:
@@ -253,7 +253,7 @@ public class JpaQueryCreator extends AbstractQueryCreator<CriteriaQuery<? extend
|
||||
case CONTAINING:
|
||||
case NOT_CONTAINING:
|
||||
|
||||
if (property.isCollection()) {
|
||||
if (property.getLeafProperty().isCollection()) {
|
||||
|
||||
Expression<Collection<Object>> propertyExpression = traversePath(root, property);
|
||||
Expression<Object> parameterExpression = provider.next(part).getExpression();
|
||||
|
||||
@@ -591,4 +591,9 @@ public interface UserRepository
|
||||
* DATAJPA-829
|
||||
*/
|
||||
List<User> findByRolesNotContaining(Role role);
|
||||
|
||||
/**
|
||||
* @see DATAJPA-858
|
||||
*/
|
||||
List<User> findByRolesNameContaining(String name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user