Skip to content

Commit

Permalink
HHH-19017: Call isLazyByGraph Before Resolving Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsimon-wk committed Jan 16, 2025
1 parent da27935 commit 52e644a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ public void resolveInstance(EntityDelayedFetchInitializerData data) {
// Try to load a PersistentAttributeInterceptable. If we get one, we can add the lazy
// field to the interceptor. If we don't get one, we load the entity by unique key.
PersistentAttributeInterceptable persistentAttributeInterceptable = null;
if (getParent().isEntityInitializer()) {
if (getParent().isEntityInitializer() && isLazyByGraph( rowProcessingState )) {
final Object resolvedInstance =
getParent().asEntityInitializer().getResolvedInstance(rowProcessingState);
getParent().asEntityInitializer().getResolvedInstance( rowProcessingState );
persistentAttributeInterceptable =
ManagedTypeHelper.asPersistentAttributeInterceptableOrNull( resolvedInstance );
}

if (persistentAttributeInterceptable != null && isLazyByGraph( rowProcessingState )) {
if ( persistentAttributeInterceptable != null ) {
final LazyAttributeLoadingInterceptor persistentAttributeInterceptor = (LazyAttributeLoadingInterceptor) persistentAttributeInterceptable.$$_hibernate_getInterceptor();
persistentAttributeInterceptor.addLazyFieldByGraph( navigablePath.getLocalName() );
instance = UNFETCHED_PROPERTY;
Expand Down

0 comments on commit 52e644a

Please sign in to comment.