Skip to content

Add support for the Querydsl IN operator in LdapSerializer.#631

Open
Ashish-CodeJourney wants to merge 1 commit into
spring-projects:mainfrom
Ashish-CodeJourney:issue-82-in-operator
Open

Add support for the Querydsl IN operator in LdapSerializer.#631
Ashish-CodeJourney wants to merge 1 commit into
spring-projects:mainfrom
Ashish-CodeJourney:issue-82-in-operator

Conversation

@Ashish-CodeJourney

@Ashish-CodeJourney Ashish-CodeJourney commented Jul 22, 2026

Copy link
Copy Markdown

Closes #82

Using a Querydsl predicate on a multi-valued attribute, e.g.:

QPerson person = QPerson.person;
repository.findAll(person.studentAliases.contains(alias));

fails with:

java.lang.UnsupportedOperationException: Unsupported operator IN
at org.springframework.data.ldap.repository.support.LdapSerializer.visit(LdapSerializer.java:99)

Querydsl translates collectionPath.contains(value) into an Ops.IN operation, which LdapSerializer did not handle.

This PR adds Ops.IN handling for both shapes Querydsl produces:

  • collectionPath.contains(value) emitted as IN(element, path) maps to (attribute=value), since LDAP equality on a multi-valued attribute matches if any value is equal.
  • path.in(a, b) emitted as IN(path, constantCollection) maps to (|(attribute=a)(attribute=b)).

path.in(singleValue) already worked because Querydsl rewrites it to eq; a test now pins that behavior.

Tests were written first and confirmed failing on unmodified main with the exact exception from the issue, then made green by the change. The new tests reuse the existing QPerson / UnitTestPerson fixtures (the description attribute is already multi-valued). Full test suite passes: 86 tests, 0 failures.

  • You have read the Spring Data contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched.

Querydsl expresses collection-path contains as IN(element, path), which now translates to an equality filter on the multi-valued attribute. IN with a constant collection translates to an OR of equality filters.

Signed-off-by: Ashish Vaghela <ashish.vaghela@nelkinda.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants