Debbie Philip (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *commented* on HHH-16755 (
https://hibernate.atlassian.net/browse/HHH-16755?atlOrigin=eyJpIjoiMmJiMj...
)
Re: NPE while retrieving static metamodel attribute of an embeddable within an entity (
https://hibernate.atlassian.net/browse/HHH-16755?atlOrigin=eyJpIjoiMmJiMj...
)
https://hibernate.atlassian.net/browse/HHH-16378 The code done for this ticket seems to
break the existing logic in our project, due to the addition of this condition in
MetadataContext.java:
*v6.2.2:*
while(!this.embeddablesToProcess.isEmpty()){
…
if ( !( embeddable.getExpressibleJavaType() instanceof EntityJavaType ) ) {
this.embeddables.put( embeddable.getJavaType(), embeddable );
if ( staticMetamodelScanEnabled )
{ this.populateStaticMetamodel( embeddable ); }
}
}
*v6.2.3 onwards:*
while ( ! embeddablesToProcess.isEmpty() ) {
...
// Do not process embeddables for entity types i.e. id-classes or
// generic component embeddables used just for concrete type resolution
if ( ! *component.isGeneric()* && !( embeddable.getExpressibleJavaType()
instanceof EntityJavaType<?> ) ) {
embeddables.put( embeddable.getJavaType(), embeddable );
if ( staticMetamodelScanEnabled )
{ populateStaticMetamodel( embeddable ); }
}
}
In the attached test case, code fails if we have a embeddable that is generic and extends
properties from a superclass. Even though the association between the embeddable and the
superclass property is understood in the mapping phase, it doesn't get populated. So
while ExampleEmbedded_.user compiles, it throws a NPE at runtime.
We have quite a few places entrenched in our project where we need to use a generic
embeddable class extending from a super class, with properties defined in the super class.
Changing it to stop extending the superclass or making the embeddable non-generic would
require quite a bit of rework of the project architecture.
(
https://hibernate.atlassian.net/browse/HHH-16755#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16755#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100233- sha1:b4f309b )