Skip to content

Commit

Permalink
HHH-17081 Avoid error for same prop name in different inheritance types
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed Aug 31, 2023
1 parent 14b1337 commit 21d13ec
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ protected boolean shouldSkipResolveInstance(RowProcessingState rowProcessingStat
.getEntityMetamodel()
.isPolymorphic() ) {
parentInitializer.resolveKey( rowProcessingState );
return isReferencedModelPartInConcreteParent(
return !isReferencedModelPartInConcreteParent(
modelPart,
currentNavigablePath,
parentInitializer
Expand All @@ -437,7 +437,13 @@ private boolean isReferencedModelPartInConcreteParent(
final EntityPersister parentConcreteDescriptor = parentInitializer.asEntityInitializer()
.getConcreteDescriptor();
if ( parentConcreteDescriptor != null && parentConcreteDescriptor.getEntityMetamodel().isPolymorphic() ) {
final ModelPart concreteModelPart = parentConcreteDescriptor.findByPath( partNavigablePath.getLocalName() );
final EntityMappingType entityType = modelPart.asAttributeMapping() != null ?
modelPart.asAttributeMapping().getDeclaringType().findContainingEntityMapping() :
modelPart.asEntityMappingType();
final ModelPart concreteModelPart = parentConcreteDescriptor.findSubPart(
partNavigablePath.getLocalName(),
entityType
);
if ( concreteModelPart == null
|| !modelPart.getJavaType().getJavaTypeClass()
.isAssignableFrom( concreteModelPart.getJavaType().getJavaTypeClass() ) ) {
Expand Down Expand Up @@ -470,10 +476,10 @@ class AddressB extends Address{
and for AddressB skip resolving the EntityJoinedFetchInitializer of UserA
*/
return true;
return false;
}
}
return false;
return true;
}

protected void resolveEntityInstance(
Expand Down

0 comments on commit 21d13ec

Please sign in to comment.