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(); final KeyValue bootDescriptorIdentifier = bootDescriptor.getIdentifier();
if ( bootDescriptorIdentifier instanceof Component ) { if ( bootDescriptorIdentifier instanceof Component ) {
final Component component = (Component) bootDescriptorIdentifier;
if ( bootDescriptor.getIdentifierMapper() != null ) { if ( bootDescriptor.getIdentifierMapper() != null ) {
mapsIdRepresentationStrategy = new StandardPojoEmbeddableRepresentationStrategy( mapsIdRepresentationStrategy = new StandardPojoEmbeddableRepresentationStrategy(
bootDescriptor.getIdentifierMapper(), bootDescriptor.getIdentifierMapper(),
creationContext creationContext
); );
} }
else if ( bootDescriptorIdentifier != null ) {
mapsIdRepresentationStrategy = new StandardPojoEmbeddableRepresentationStrategy(
(Component) bootDescriptorIdentifier,
creationContext
);
}
else { else {
mapsIdRepresentationStrategy = null; mapsIdRepresentationStrategy = null;
} }

View File

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