Skip to content

[OPENJPA-2979] Support composite ids in getReference(entity) - #188

Merged
cristof merged 1 commit into
masterfrom
OPENJPA-2979
Sep 15, 2026
Merged

cristof merged 1 commit into
masterfrom
OPENJPA-2979

Conversation

@rzo1

@rzo1 rzo1 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

getReference(entity) only read the primary key for entities with a single id field, so IdClass and EmbeddedId entities failed with a misleading "null pk" error. The id is now derived via the state manager or ApplicationIds, and the entity class is resolved through superclasses so runtime subclasses work. An instance without an assigned id fails with a clear message; TestGetReferenceByEntity covers single, IdClass and EmbeddedId ids for managed, detached and new instances.

Derive the object id from the instance's state manager or its primary
key fields instead of reading a single id field, resolve metadata for
generated subclasses and fail with a clear message when no id is set.
@rzo1 rzo1 self-assigned this Sep 14, 2026
@rzo1
rzo1 requested review from cristof and solomax September 14, 2026 18:27
@cristof
cristof merged commit e81fbc0 into master Sep 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants