HHH-16166 Correct Plural and ToOne attribute mapping declaring types
This commit is contained in:
parent
52e1026b72
commit
b0b1fbbff7
|
@ -397,15 +397,12 @@ public abstract class AbstractEmbeddableMapping implements EmbeddableMappingType
|
|||
columnPosition += columnSpan;
|
||||
}
|
||||
else if ( subtype instanceof CollectionType ) {
|
||||
final EntityPersister entityPersister = creationProcess.getEntityPersister( bootDescriptor.getOwner()
|
||||
.getEntityName() );
|
||||
|
||||
attributeMapping = MappingModelCreationHelper.buildPluralAttributeMapping(
|
||||
bootPropertyDescriptor.getName(),
|
||||
attributeIndex,
|
||||
attributeIndex,
|
||||
bootPropertyDescriptor,
|
||||
entityPersister,
|
||||
this,
|
||||
propertyAccess,
|
||||
compositeType.getCascadeStyle( attributeIndex ),
|
||||
compositeType.getFetchMode( attributeIndex ),
|
||||
|
@ -422,7 +419,7 @@ public abstract class AbstractEmbeddableMapping implements EmbeddableMappingType
|
|||
attributeIndex,
|
||||
attributeIndex,
|
||||
bootPropertyDescriptor,
|
||||
entityPersister,
|
||||
this,
|
||||
entityPersister,
|
||||
(EntityType) subtype,
|
||||
representationStrategy.resolvePropertyAccess( bootPropertyDescriptor ),
|
||||
|
|
|
@ -496,14 +496,12 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme
|
|||
columnPosition += columnSpan;
|
||||
}
|
||||
else if ( subtype instanceof CollectionType ) {
|
||||
final EntityPersister entityPersister = creationProcess.getEntityPersister( bootDescriptor.getOwner().getEntityName() );
|
||||
|
||||
attributeMapping = MappingModelCreationHelper.buildPluralAttributeMapping(
|
||||
bootPropertyDescriptor.getName(),
|
||||
attributeIndex,
|
||||
attributeIndex,
|
||||
bootPropertyDescriptor,
|
||||
entityPersister,
|
||||
this,
|
||||
representationStrategy.resolvePropertyAccess( bootPropertyDescriptor ),
|
||||
compositeType.getCascadeStyle( attributeIndex),
|
||||
compositeType.getFetchMode( attributeIndex ),
|
||||
|
@ -519,7 +517,7 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme
|
|||
attributeIndex,
|
||||
attributeIndex,
|
||||
bootPropertyDescriptor,
|
||||
entityPersister,
|
||||
this,
|
||||
entityPersister,
|
||||
(EntityType) subtype,
|
||||
getRepresentationStrategy().resolvePropertyAccess( bootPropertyDescriptor ),
|
||||
|
|
|
@ -718,7 +718,7 @@ public class MappingModelCreationHelper {
|
|||
fkTargetPart = collectionDescriptor.getOwnerEntityPersister().getIdentifierMapping();
|
||||
}
|
||||
else {
|
||||
fkTargetPart = declaringType.findAttributeMapping( lhsPropertyName );
|
||||
fkTargetPart = declaringType.findContainingEntityMapping().findAttributeMapping( lhsPropertyName );
|
||||
}
|
||||
|
||||
if ( keyType instanceof BasicType ) {
|
||||
|
|
|
@ -84,7 +84,8 @@ public interface Initializer {
|
|||
if ( entityInitializer != null ) {
|
||||
final EntityPersister concreteDescriptor = entityInitializer.getConcreteDescriptor();
|
||||
if ( concreteDescriptor.getEntityMetamodel().isPolymorphic() ) {
|
||||
final EntityPersister declaringType = (EntityPersister) referencedModelPart.getDeclaringType();
|
||||
final EntityPersister declaringType = (EntityPersister) referencedModelPart.getDeclaringType()
|
||||
.findContainingEntityMapping();
|
||||
if ( concreteDescriptor != declaringType ) {
|
||||
return declaringType.getSubclassEntityNames().contains( concreteDescriptor.getEntityName() );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue