diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/entitygraph/EntityGraphLoadPlanBuilderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/entitygraph/EntityGraphLoadPlanBuilderTest.java index 977ef331df..37cd65f52b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/entitygraph/EntityGraphLoadPlanBuilderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/entitygraph/EntityGraphLoadPlanBuilderTest.java @@ -291,9 +291,13 @@ public class EntityGraphLoadPlanBuilderTest { ); // Check the from-clause - assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> - assertThat( tableGroup.getTableGroupJoins(), isEmpty() ) - ); + assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> { + assertThat( tableGroup.getTableGroupJoins(), hasSize( 1 ) ); + + final TableGroup compositeTableGroup = CollectionUtils.getOnlyElement( tableGroup.getTableGroupJoins() ).getJoinedGroup(); + assertThat( compositeTableGroup, instanceOf( CompositeTableGroup.class ) ); + assertThat( compositeTableGroup.getTableGroupJoins(), isEmpty() ); + } ); } ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/entitygraph/HqlEntityGraphTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/entitygraph/HqlEntityGraphTest.java index 7b178db0fe..eac3ccfd3e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/entitygraph/HqlEntityGraphTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/entitygraph/HqlEntityGraphTest.java @@ -54,6 +54,7 @@ import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.Test; +import org.junit.platform.commons.util.CollectionUtils; import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; @@ -294,7 +295,13 @@ public class HqlEntityGraphTest { ); // Check the from-clause - assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> assertThat( tableGroup.getTableGroupJoins(), isEmpty() ) ); + assertPluralAttributeJoinedGroup( sqlAst, "shipAddresses", tableGroup -> { + assertThat( tableGroup.getTableGroupJoins(), hasSize( 1 ) ); + + final TableGroup compositeTableGroup = CollectionUtils.getOnlyElement( tableGroup.getTableGroupJoins() ).getJoinedGroup(); + assertThat( compositeTableGroup, instanceOf( CompositeTableGroup.class ) ); + assertThat( compositeTableGroup.getTableGroupJoins(), isEmpty() ); + } ); } ); @@ -390,7 +397,7 @@ public class HqlEntityGraphTest { ); final HqlQueryImplementor hqlQuery = (HqlQueryImplementor) query; - final SqmSelectStatement sqmStatement = (SqmSelectStatement) hqlQuery.getSqmStatement(); + final SqmSelectStatement sqmStatement = (SqmSelectStatement) hqlQuery.getSqmStatement(); final StandardSqmSelectTranslator sqmConverter = new StandardSqmSelectTranslator( hqlQuery.getQueryOptions(),