HHH-16849 Fix partition key inside multi-column foreign key

This commit is contained in:
Marco Belladelli 2023-07-04 15:05:57 +02:00 committed by Steve Ebersole
parent b9e8d71dc8
commit 78cc85aa05
1 changed files with 4 additions and 1 deletions

View File

@ -207,6 +207,7 @@ public class MappingModelCreationHelper {
final FetchTiming fetchTiming;
final FetchStyle fetchStyle;
final boolean partitioned;
if ( declaringType instanceof EmbeddableMappingType ) {
if ( bootProperty.isLazy() ) {
MAPPING_MODEL_CREATION_MESSAGE_LOGGER.debugf(
@ -217,10 +218,12 @@ public class MappingModelCreationHelper {
}
fetchTiming = FetchTiming.IMMEDIATE;
fetchStyle = FetchStyle.JOIN;
partitioned = value.isPartitionKey() && !( (EmbeddableMappingType) declaringType ).getEmbeddedValueMapping().isVirtual();
}
else {
fetchTiming = bootProperty.isLazy() ? FetchTiming.DELAYED : FetchTiming.IMMEDIATE;
fetchStyle = bootProperty.isLazy() ? FetchStyle.SELECT : FetchStyle.JOIN;
partitioned = value.isPartitionKey();
}
return new BasicAttributeMapping(
@ -244,7 +247,7 @@ public class MappingModelCreationHelper {
nullable,
insertable,
updateable,
value.isPartitionKey(),
partitioned,
attrType,
declaringType,
propertyAccess