spring-data-ldap icon indicating copy to clipboard operation
spring-data-ldap copied to clipboard

Predicate fails with message: Unsupported operator IN [DATALDAP-62]

Open spring-projects-issues opened this issue 7 years ago • 0 comments

Alex opened DATALDAP-62 and commented

I have a POJO class that contains LDAP attributes. The class is annotated with @Entry annotation. The entity has some fields as a collection (i.e. Set<String>) but most of the POJO fields are just String values. When I try to use LdapRepository's findAll method with Predicate to search through multi-valued fields with using Collection.contains(...) method the spring-data-ldap throws the exception:

java.lang.UnsupportedOperationException: Unsupported operator IN
at org.springframework.data.ldap.repository.support.LdapSerializer.visit(LdapSerializer.java:108)
at org.springframework.data.ldap.repository.support.LdapSerializer.visit(LdapSerializer.java:37)
at com.querydsl.core.types.OperationImpl.accept(OperationImpl.java:83)

I was able to trace the problem and it looks like when Collection type of an attribute is used for a Predicate's query then QueryDSL provides IN operation which is not supported by Spring's LdapSerializer class. Here is the sample of the Predicate:

QPerson person = QPerson.person;
return person.studentAliases.contains(alias).or(person.employeeAliases.contains(alias));

Is it possible to add support for IN operation same way as EQ operator so DATA-LDAP module processes multi-valued attributes without any issues?


No further details from DATALDAP-62

spring-projects-issues avatar Feb 22 '18 19:02 spring-projects-issues