Skip to content

Comments

Fix embedded path ColumnInfo access for composite IDs (GH-2201)#2219

Closed
62hoon99 wants to merge 4 commits intospring-projects:mainfrom
62hoon99:fix-2201
Closed

Fix embedded path ColumnInfo access for composite IDs (GH-2201)#2219
62hoon99 wants to merge 4 commits intospring-projects:mainfrom
62hoon99:fix-2201

Conversation

@62hoon99
Copy link

Summary

Fix IllegalArgumentException: Cannot obtain ColumnInfo for embedded path when using class-based composite IDs as @Id properties.

Problem

When ResolvingRelationalPropertyValueProvider resolves identifiers for entities with composite IDs, it delegates to DocumentValueProvider.getValue() for embedded paths.
Embedded paths do not have a single ColumnInfo, which results in an IllegalArgumentException.

Solution

Update DocumentValueProvider to properly handle embedded paths:

  • getValue(): return null for embedded paths (values are resolved via individual properties)
  • hasValue() / hasNonEmptyValue(): recursively evaluate embedded properties

Changes

  • Updated MappingRelationalConverter.DocumentValueProvider to handle embedded paths correctly
  • Added unit tests for both class-based and record-based composite IDs
  • Added integration tests covering ResolvingRelationalPropertyValueProvider behavior

Testing

All tests pass. Both class-based and record-based composite IDs are now handled correctly.

Fixes #2201

Checklist

  • I have read the Spring Data contribution guidelines.
  • I used the provided code formatters and did not submit formatting-only changes.
  • I added unit and/or integration tests that back my changes.
  • I added myself as author in the headers of the classes I touched and updated the license headers where required.

We now allow returning null values if a conversion of a simple value yields null.

Closes spring-projects#2217

(cherry picked from commit e892849)
Fix nullability issues.

See spring-projects#2217

(cherry picked from commit 08c86dc)
@62hoon99
Copy link
Author

Recreated this PR from a clean branch to fix history/CI issues.
New PR: #2201
Closing this one to avoid confusion.

@62hoon99 62hoon99 closed this Jan 18, 2026
@62hoon99 62hoon99 deleted the fix-2201 branch January 18, 2026 05:29
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.

Cannot obtain ColumnInfo for embedded path

3 participants