Skip to content

Conversation

orange-guo
Copy link
Contributor

@orange-guo orange-guo commented Sep 11, 2025

When using projection queries with entities that have @Attribute annotations for LDAP field mapping, the query was using Java field names instead of the mapped LDAP attribute names. This caused queries to fail when the Java field name differs from the LDAP attribute name.

Changes:

  • Modified LdapQueryCreator to map projection fields using ObjectDirectoryMapper.attributeFor() method
    • Updated test assertions to verify correct LDAP attribute names are used in queries (e.g., "sn" instead of "lastName")
      Example: For an entity field 'groupId' mapped to LDAP attribute 'gidNumber' via @Attribute annotation, projection queries now correctly use 'gidNumber' in the LDAP query.

Fixes projection queries for entities with custom LDAP attribute mappings.

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don't submit any formatting related changes.
  • 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. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

When using projection queries with entities that have @Attribute annotations
for LDAP field mapping, the query was using Java field names instead of
the mapped LDAP attribute names. This caused queries to fail when the
Java field name differs from the LDAP attribute name.

Changes:
- Modified LdapQueryCreator to map projection fields using
  ObjectDirectoryMapper.attributeFor() method
- Updated test assertions to verify correct LDAP attribute names
  are used in queries (e.g., "sn" instead of "lastName")

Example: For an entity field 'groupId' mapped to LDAP attribute
'gidNumber' via @Attribute annotation, projection queries now
correctly use 'gidNumber' in the LDAP query.

Fixes projection queries for entities with custom LDAP attribute mappings.

Signed-off-by: Xiangcheng Kuo <1159946129@qq.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 11, 2025
@orange-guo orange-guo force-pushed the topic/xcg/fix_ldap_query_properties_mapping branch from 1119b49 to 2b3fe2b Compare September 11, 2025 04:03
@mp911de mp911de self-assigned this Sep 11, 2025
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 11, 2025
@mp911de mp911de added this to the 3.4.10 (2024.1.10) milestone Sep 11, 2025
@mp911de mp911de closed this in 73641fd Sep 11, 2025
mp911de added a commit that referenced this pull request Sep 11, 2025
Simplify stream collector, add author tag and ticket references.

See #573
mp911de pushed a commit that referenced this pull request Sep 11, 2025
When using projection queries with entities that have @Attribute annotations
for LDAP field mapping, the query was using Java field names instead of
the mapped LDAP attribute names. This caused queries to fail when the
Java field name differs from the LDAP attribute name.

Signed-off-by: Xiangcheng Kuo <1159946129@qq.com>
Closes #573
mp911de added a commit that referenced this pull request Sep 11, 2025
Simplify stream collector, add author tag and ticket references.

See #573
mp911de pushed a commit that referenced this pull request Sep 11, 2025
When using projection queries with entities that have @Attribute annotations
for LDAP field mapping, the query was using Java field names instead of
the mapped LDAP attribute names. This caused queries to fail when the
Java field name differs from the LDAP attribute name.

Signed-off-by: Xiangcheng Kuo <1159946129@qq.com>
Closes #573
mp911de added a commit that referenced this pull request Sep 11, 2025
Simplify stream collector, add author tag and ticket references.

See #573
@mp911de
Copy link
Member

mp911de commented Sep 11, 2025

Thank you for your contribution. That's merged, polished, and backported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants