HHH-18565 Mark bytecode enhanced lazy entities as RESOLVED
This commit is contained in:
parent
1a03011d8e
commit
c1d9ac00bf
|
@ -641,9 +641,9 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final RowProcessingState rowProcessingState = data.getRowProcessingState();
|
final RowProcessingState rowProcessingState = data.getRowProcessingState();
|
||||||
assert entityEntry == rowProcessingState.getSession()
|
final PersistenceContext persistenceContext = rowProcessingState.getSession()
|
||||||
.getPersistenceContextInternal()
|
.getPersistenceContextInternal();
|
||||||
.getEntry( data.entityInstanceForNotify );
|
assert entityEntry == persistenceContext.getEntry( data.entityInstanceForNotify );
|
||||||
final Object[] loadedState = entityEntry.getLoadedState();
|
final Object[] loadedState = entityEntry.getLoadedState();
|
||||||
final Object[] state;
|
final Object[] state;
|
||||||
if ( loadedState == null ) {
|
if ( loadedState == null ) {
|
||||||
|
@ -939,10 +939,27 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
&& ( (ToOneAttributeMapping) referencedModelPart ).getSideNature() == TARGET;
|
&& ( (ToOneAttributeMapping) referencedModelPart ).getSideNature() == TARGET;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( data.concreteDescriptor.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading()
|
||||||
|
&& isPersistentAttributeInterceptable( data.entityInstanceForNotify )
|
||||||
|
&& getAttributeInterceptor( data.entityInstanceForNotify ) instanceof EnhancementAsProxyLazinessInterceptor enhancementInterceptor
|
||||||
|
&& !enhancementInterceptor.isInitialized() ) {
|
||||||
|
data.setState( State.RESOLVED );
|
||||||
|
}
|
||||||
|
else {
|
||||||
// If the entity initializer is null, we know the entity is fully initialized,
|
// If the entity initializer is null, we know the entity is fully initialized,
|
||||||
// otherwise it will be initialized by some other initializer
|
// otherwise it will be initialized by some other initializer
|
||||||
data.setState( data.entityHolder.getEntityInitializer() == null ? State.INITIALIZED : State.RESOLVED );
|
data.setState( data.entityHolder.getEntityInitializer() == null ? State.INITIALIZED : State.RESOLVED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( data.getState() == State.RESOLVED ) {
|
||||||
|
data.entityHolder = persistenceContext.claimEntityHolderIfPossible(
|
||||||
|
data.entityKey,
|
||||||
|
data.entityInstanceForNotify,
|
||||||
|
rowProcessingState.getJdbcValuesSourceProcessingState(),
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( lazyInitializer.isUninitialized() ) {
|
else if ( lazyInitializer.isUninitialized() ) {
|
||||||
data.setState( State.RESOLVED );
|
data.setState( State.RESOLVED );
|
||||||
// Read the discriminator from the result set if necessary
|
// Read the discriminator from the result set if necessary
|
||||||
|
@ -1751,6 +1768,10 @@ public class EntityInitializerImpl extends AbstractInitializer<EntityInitializer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static PersistentAttributeInterceptor getAttributeInterceptor(Object entity) {
|
||||||
|
return asPersistentAttributeInterceptable( entity ).$$_hibernate_getInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EntityJoinedFetchInitializer(" + LoggingHelper.toLoggableString( getNavigablePath() ) + ")";
|
return "EntityJoinedFetchInitializer(" + LoggingHelper.toLoggableString( getNavigablePath() ) + ")";
|
||||||
|
|
Loading…
Reference in New Issue