Repository navigation
[OPENJPA-2953] Keep converter overrides out of shared embeddable and superclass meta - #200
Merged
Merged
Conversation
…superclass meta propagateEmbeddedConverters() set the converter both on the per-embedding embedded metadata copy and on the repository-level ClassMetaData of the embeddable type. The latter is shared by every entity embedding that embeddable, so a @convert(attributeName=...) declared by one entity leaked into all other embeddings (last resolved wins). Only the per-embedding copy is updated now. A converter declared on the embeddable's own attribute is unaffected and still applies everywhere. A class-level @convert(attributeName=...) for an attribute inherited from a MappedSuperclass leaked the same way: the override was written to the field metadata owned by the superclass, which getFields() splices into every sibling subclass. The override is applied to the subclass' own redefinition of the inherited field now, after defineSuperclassFields() created it. For a collection or map of embeddables the embedded metadata hangs off the element resp. key value, not off the field's value, so such overrides were collected and then silently dropped. All three value slots are considered now, with "key." and "value." addressing a map's key resp. value.
solomax
approved these changes
Oct 6, 2026
cristof
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
@Convert(attributeName=...)override was written into metadata shared between entities: for an embeddable it went to the repository-levelClassMetaDatathat every embedding copies from, and for an attribute inherited from a@MappedSuperclassit went to the superclass ownFieldMetaData, so in both cases the last resolved entity won for all of them. Overrides now apply only to the per-embedding copy and to the entity own redefinition of an inherited field, and an override on an@ElementCollectionof an embeddable — which was previously ignored — is applied as well. A converter declared on the embeddable own attribute still applies everywhere.