HHH-18478 Retrieve concrete entity descriptor inside entity initializer's resolve state

This commit is contained in:
Marco Belladelli 2024-09-03 10:48:00 +02:00
parent 03d9671e02
commit 1951c0b993
1 changed files with 12 additions and 0 deletions

View File

@ -86,6 +86,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import static org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer.UNFETCHED_PROPERTY;
import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable;
import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable;
import static org.hibernate.internal.util.NullnessUtil.castNonNull;
import static org.hibernate.metamodel.mapping.ForeignKeyDescriptor.Nature.TARGET;
import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer;
@ -1622,10 +1623,21 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
if ( rowIdAssembler != null ) {
rowIdAssembler.resolveState( data.getRowProcessingState() );
}
if ( data.concreteDescriptor == null ) {
data.concreteDescriptor = data.defaultConcreteDescriptor;
if ( data.concreteDescriptor == null ) {
data.concreteDescriptor = determineConcreteEntityDescriptor(
data.getRowProcessingState(),
castNonNull( discriminatorAssembler ),
entityDescriptor
);
}
}
resolveEntityState( data );
}
protected void resolveEntityState(EntityInitializerData data) {
assert data.concreteDescriptor != null;
final RowProcessingState rowProcessingState = data.getRowProcessingState();
for ( final DomainResultAssembler<?> assembler : assemblers[data.concreteDescriptor.getSubclassId()] ) {
if ( assembler != null ) {