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( final Fetch fetch = parent.generateFetchableFetch(
fetchable, fetchable,
fetchPath, fetchPath,
FetchTiming.DELAYED, fetchable.getMappedFetchOptions().getTiming(),
false, false,
null, null,
creationState creationState

View File

@ -52,7 +52,7 @@ public class ImplicitFetchBuilderPlural implements ImplicitFetchBuilder {
final Fetch fetch = parent.generateFetchableFetch( final Fetch fetch = parent.generateFetchableFetch(
fetchable, fetchable,
fetchPath, fetchPath,
FetchTiming.DELAYED, fetchable.getMappedFetchOptions().getTiming(),
false, false,
null, null,
creationState 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.basic.BasicFetch;
import org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch; import org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch;
import org.hibernate.sql.results.graph.embeddable.EmbeddableResultGraphNode; 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 * This is essentially a List of Fetch(es), but exposing
@ -50,7 +51,7 @@ public interface FetchList extends Iterable<Fetch> {
default boolean hasJoinFetches() { default boolean hasJoinFetches() {
for ( Fetch fetch : this ) { 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 // That's fine
} }
else if ( fetch instanceof EmbeddableResultGraphNode ) { else if ( fetch instanceof EmbeddableResultGraphNode ) {