HHH-16191 Fix eager associations not fetched with native queries

This commit is contained in:
Marco Belladelli 2023-02-21 17:40:02 +01:00 committed by Christian Beikov
parent e3c3669114
commit 1f4f0c6ec1
3 changed files with 4 additions and 3 deletions

View File

@ -130,7 +130,7 @@ public class ImplicitFetchBuilderEntity implements ImplicitFetchBuilder {
final Fetch fetch = parent.generateFetchableFetch(
fetchable,
fetchPath,
FetchTiming.DELAYED,
fetchable.getMappedFetchOptions().getTiming(),
false,
null,
creationState

View File

@ -52,7 +52,7 @@ public class ImplicitFetchBuilderPlural implements ImplicitFetchBuilder {
final Fetch fetch = parent.generateFetchableFetch(
fetchable,
fetchPath,
FetchTiming.DELAYED,
fetchable.getMappedFetchOptions().getTiming(),
false,
null,
creationState

View File

@ -16,6 +16,7 @@ import org.hibernate.internal.util.IndexedConsumer;
import org.hibernate.sql.results.graph.basic.BasicFetch;
import org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch;
import org.hibernate.sql.results.graph.embeddable.EmbeddableResultGraphNode;
import org.hibernate.sql.results.graph.entity.internal.AbstractNonJoinedEntityFetch;
/**
* This is essentially a List of Fetch(es), but exposing
@ -50,7 +51,7 @@ public interface FetchList extends Iterable<Fetch> {
default boolean hasJoinFetches() {
for ( Fetch fetch : this ) {
if ( fetch instanceof BasicFetch<?> || fetch.getTiming() == FetchTiming.DELAYED ) {
if ( fetch instanceof BasicFetch<?> || fetch instanceof AbstractNonJoinedEntityFetch || fetch.getTiming() == FetchTiming.DELAYED ) {
// That's fine
}
else if ( fetch instanceof EmbeddableResultGraphNode ) {