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:
Oliver Gierke
2016-02-10 18:19:32 +01:00
parent 1c5a86af08
commit 5455b8c8dc
2 changed files with 6 additions and 1 deletions

View File

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

View File

@@ -591,4 +591,9 @@ public interface UserRepository
* DATAJPA-829
*/
List<User> findByRolesNotContaining(Role role);
/**
* @see DATAJPA-858
*/
List<User> findByRolesNameContaining(String name);
}