[
https://issues.apache.org/jira/browse/OPENJPA-2953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123708#comment-18123708
]
ASF subversion and git services commented on OPENJPA-2953:
----------------------------------------------------------
Commit fcc923bb3601a8d2374d62a76094b99d2e3c4d1f in openjpa's branch
refs/heads/master from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=fcc923bb3 ]
[OPENJPA-2953] Keep converter overrides out of shared embeddable and 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.
> Embedded converter override leaks to shared embeddable meta
> -----------------------------------------------------------
>
> Key: OPENJPA-2953
> URL: https://issues.apache.org/jira/browse/OPENJPA-2953
> Project: OpenJPA
> Issue Type: Sub-task
> Components: jpa
> Affects Versions: 4.2.0
> Reporter: Maxim Solodovnik
> Priority: Major
> Fix For: 4.2.0
>
>
> Discussion thread:
> https://github.com/apache/openjpa/pull/144#discussion_r3682999733
> **(medium)** `propagateEmbeddedConverters()` sets the converter on the shared
> embeddable ClassMetaData. If two entities embed the same embeddable but only
> one declares `@Convert(attributeName=...)`, the override leaks to all other
> usages (last-resolved wins). Should the override only apply to the
> per-embedding `embeddedMeta` copy?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)