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 8af344e48a
commit 48607ade1c
1 changed files with 12 additions and 1 deletions

View File

@ -86,7 +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.log.LoggingHelper.toLoggableString;
import static org.hibernate.internal.util.NullnessUtil.castNonNull;
import static org.hibernate.metamodel.mapping.ForeignKeyDescriptor.Nature.TARGET;
import static org.hibernate.proxy.HibernateProxy.extractLazyInitializer;
@ -1603,10 +1603,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 ) {