Fix issue with EmbeddableMappingType creation

This commit is contained in:
Andrea Boriero 2021-04-06 15:18:30 +02:00
parent 7fc2593515
commit f6f1cb06d4
2 changed files with 9 additions and 10 deletions

View File

@ -109,13 +109,18 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
final KeyValue bootDescriptorIdentifier = bootDescriptor.getIdentifier();
if ( bootDescriptorIdentifier instanceof Component ) {
final Component component = (Component) bootDescriptorIdentifier;
if ( bootDescriptor.getIdentifierMapper() != null ) {
mapsIdRepresentationStrategy = new StandardPojoEmbeddableRepresentationStrategy(
bootDescriptor.getIdentifierMapper(),
creationContext
);
}
else if ( bootDescriptorIdentifier != null ) {
mapsIdRepresentationStrategy = new StandardPojoEmbeddableRepresentationStrategy(
(Component) bootDescriptorIdentifier,
creationContext
);
}
else {
mapsIdRepresentationStrategy = null;
}

View File

@ -171,17 +171,11 @@ public class MappingModelCreationHelper {
propertyAccess
);
Component bootComponentDescriptor = bootEntityDescriptor.getIdentifierMapper();
final List<SingularAttributeMapping> idAttributeMappings;
final Iterator<Property> bootIdSubPropertyItr;
if ( bootComponentDescriptor == null ) {
idAttributeMappings = new ArrayList<>( bootIdClassComponent.getPropertySpan() );
bootIdSubPropertyItr = bootIdClassComponent.getPropertyIterator();
}
else {
idAttributeMappings = new ArrayList<>( bootComponentDescriptor.getPropertySpan() );
bootIdSubPropertyItr = bootComponentDescriptor.getPropertyIterator();
bootComponentDescriptor = bootIdClassComponent;
}
final List<SingularAttributeMapping> idAttributeMappings = new ArrayList<>( bootComponentDescriptor.getPropertySpan() );
final Iterator<Property> bootIdSubPropertyItr = bootComponentDescriptor.getPropertyIterator();
int columnsConsumedSoFar = 0;