HHH-17224 Respect association fetch style for dynamic results

This commit is contained in:
Marco Belladelli 2023-10-03 12:28:31 +02:00
parent c29869ec7b
commit 50a83ba953
2 changed files with 4 additions and 9 deletions

View File

@ -1890,10 +1890,9 @@ public abstract class AbstractEntityPersister
final Fetchable fetchable = fetchableContainer.getFetchable( i );
// Ignore plural attributes
if ( !( fetchable instanceof PluralAttributeMapping ) ) {
final FetchTiming fetchTiming;
final FetchTiming fetchTiming = fetchable.getMappedFetchOptions().getTiming();
if ( fetchable instanceof BasicValuedModelPart ) {
// Ignore lazy basic columns
fetchTiming = fetchable.getMappedFetchOptions().getTiming();
if ( fetchTiming == FetchTiming.DELAYED ) {
continue;
}
@ -1908,10 +1907,6 @@ public abstract class AbstractEntityPersister
if ( !getRootTableName().equals( association.getForeignKeyDescriptor().getKeyTable() ) ) {
continue;
}
fetchTiming = FetchTiming.DELAYED;
}
else {
fetchTiming = fetchable.getMappedFetchOptions().getTiming();
}
if ( fetchTiming == null ) {
@ -1923,7 +1918,7 @@ public abstract class AbstractEntityPersister
fetchable,
fetchParent.resolveNavigablePath( fetchable ),
fetchTiming,
true,
false,
null,
creationState
);

View File

@ -142,7 +142,7 @@ public class DynamicFetchBuilderStandard
return parent.generateFetchableFetch(
attributeMapping,
fetchPath,
FetchTiming.DELAYED,
attributeMapping.getMappedFetchOptions().getTiming(),
false,
null,
creationStateImpl
@ -165,7 +165,7 @@ public class DynamicFetchBuilderStandard
return parent.generateFetchableFetch(
attributeMapping,
fetchPath,
FetchTiming.DELAYED,
attributeMapping.getMappedFetchOptions().getTiming(),
false,
null,
creationStateImpl