Skip to content

[OPENJPA-2957] Resolve embeddables through the metadata repository instead of annotation names - #159

Merged
cristof merged 1 commit into
masterfrom
OPENJPA-2957
Aug 24, 2026
Merged

[OPENJPA-2957] Resolve embeddables through the metadata repository instead of annotation names#159
cristof merged 1 commit into
masterfrom
OPENJPA-2957

Conversation

@rzo1

@rzo1 rzo1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Replaces the simple-name annotation scan in AbstractExpressionBuilder.hasEmbeddableAnnotation with a repository lookup, as suggested in https://issues.apache.org/jira/browse/OPENJPA-2957. ClassMetaData.isEmbeddable() is set by both the annotation and the XML parser, so it also covers embeddables declared only in orm.xml and no longer matches any annotation that happens to be called Embeddable.

Note that fmd.getEmbeddedMetaData() cannot be used directly here: the guard is only reached when that call already returned null, so the check has to ask about the declared type instead. This is a robustness fix rather than a behavioural one — I could not construct a case where the old check produced a wrong answer, since the branch is only reachable for an @EmbeddedId field whose embedded metadata is absent. openjpa.persistence.embed.** (89 tests, including the XML-mapped ones) and the TestDerivedIdEx2b / TestUnenhancedDerivedIdEx2b regression tests for the original 2.4.1.3 ex2b fix are green.

@rzo1 rzo1 self-assigned this Aug 21, 2026
@rzo1
rzo1 requested a review from solomax August 21, 2026 12:28

@solomax solomax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@cristof
cristof merged commit 2b8e3b7 into master Aug 24, 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