Skip to content

Resolve IdClass exception for mapped superclasses with mixed access types.#4252

Open
myleshk wants to merge 1 commit into
spring-projects:mainfrom
myleshk:gh-4246-inherited-id-mappedsuperclass
Open

Resolve IdClass exception for mapped superclasses with mixed access types.#4252
myleshk wants to merge 1 commit into
spring-projects:mainfrom
myleshk:gh-4246-inherited-id-mappedsuperclass

Conversation

@myleshk
Copy link
Copy Markdown

@myleshk myleshk commented May 13, 2026

When an @entity uses @access(FIELD) and extends a @MappedSuperclass that uses @access(PROPERTY) with @id on a getter, getSingularAttributes() may not include the inherited @id attribute.

Added a fallback in findAttributes() that calls source.getId() to resolve the attribute through the type hierarchy when the for-loop over getSingularAttributes() doesn't find the @id.

Closes #4246

…ypes.

When an @entity uses @access(FIELD) and extends a @MappedSuperclass that uses @access(PROPERTY) with @id on a getter, getSingularAttributes() may not include the inherited @id attribute.

Added a fallback in findAttributes() that calls source.getId() to resolve the attribute through the type hierarchy when the for-loop over getSingularAttributes() doesn't find the @id.

Closes spring-projects#4246

Signed-off-by: Myles Fang <i@myles.hk>
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.

JpaRepository fails with "does not define an IdClass" for entities with @Id inherited from @MappedSuperclass (regression 4.0.4 → 4.0.5)

2 participants