Skip to content

Commit 35a1b2d

Browse files
committed
[#2924] Fix ReactiveCompoundNaturalIdMapping constructor
1 parent fa8dbed commit 35a1b2d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/metamodel/mapping/internal/ReactiveCompoundNaturalIdMapping.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
1414
import org.hibernate.metamodel.mapping.internal.CompoundNaturalIdMapping;
1515
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
16+
import org.hibernate.models.spi.ClassDetails;
1617
import org.hibernate.reactive.loader.ast.internal.ReactiveCompoundNaturalIdLoader;
1718
import org.hibernate.reactive.logging.impl.Log;
1819
import org.hibernate.reactive.logging.impl.LoggerFactory;
@@ -21,10 +22,12 @@ public class ReactiveCompoundNaturalIdMapping extends CompoundNaturalIdMapping {
2122

2223
private static final Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );
2324

24-
public ReactiveCompoundNaturalIdMapping(EntityMappingType declaringType,
25-
List<SingularAttributeMapping> attributes,
26-
MappingModelCreationProcess creationProcess ) {
27-
super( declaringType, attributes, creationProcess );
25+
public ReactiveCompoundNaturalIdMapping(
26+
EntityMappingType declaringType,
27+
ClassDetails naturalIdClass,
28+
List<SingularAttributeMapping> attributes,
29+
MappingModelCreationProcess creationProcess) {
30+
super( declaringType, naturalIdClass, attributes, creationProcess );
2831
}
2932

3033
@Override

hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,11 @@ default NaturalIdMapping generateNaturalIdMapping(
576576
throw new MappingException( "Expected multiple natural-id attributes, but found only one: " + getEntityName() );
577577
}
578578

579-
return new ReactiveCompoundNaturalIdMapping( this, collectedAttrMappings, creationProcess );
579+
return new ReactiveCompoundNaturalIdMapping(
580+
this,
581+
bootEntityDescriptor.getRootClass().getNaturalIdClass(),
582+
collectedAttrMappings,
583+
creationProcess );
580584
}
581585

582586
@Override

0 commit comments

Comments
 (0)