HHH-17081 Avoid error for same prop name in different inheritance types

This commit is contained in:
Marco Belladelli 2023-08-23 10:02:27 +02:00
parent 14b1337d51
commit 21d13ecc11
1 changed files with 10 additions and 4 deletions

View File

@ -419,7 +419,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
.getEntityMetamodel()
.isPolymorphic() ) {
parentInitializer.resolveKey( rowProcessingState );
return isReferencedModelPartInConcreteParent(
return !isReferencedModelPartInConcreteParent(
modelPart,
currentNavigablePath,
parentInitializer
@ -437,7 +437,13 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
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() ) ) {
@ -470,11 +476,11 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces
and for AddressB skip resolving the EntityJoinedFetchInitializer of UserA
*/
return true;
}
}
return false;
}
}
return true;
}
protected void resolveEntityInstance(
RowProcessingState rowProcessingState,