Skip to content

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

Open
rzo1 wants to merge 1 commit into
masterfrom
OPENJPA-2957
Open

[OPENJPA-2957] Resolve embeddables through the metadata repository instead of annotation names#159
rzo1 wants to merge 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
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.

2 participants