use of org.hibernate.sql.ast.tree.from.FromClause in project hibernate-orm by hibernate.
the class EntityGraphLoadPlanBuilderTest method assertPluralAttributeJoinedGroup.
private void assertPluralAttributeJoinedGroup(SelectStatement sqlAst, String expectedPluralAttributeName, Consumer<TableGroup> tableGroupConsumer) {
final FromClause fromClause = sqlAst.getQuerySpec().getFromClause();
assertThat(fromClause.getRoots(), hasSize(1));
final TableGroup root = fromClause.getRoots().get(0);
assertThat(root.getTableGroupJoins(), hasSize(1));
final TableGroup joinedGroup = CollectionUtils.getOnlyElement(root.getTableGroupJoins()).getJoinedGroup();
assertThat(joinedGroup.getModelPart().getPartName(), is(expectedPluralAttributeName));
assertThat(joinedGroup.getModelPart(), instanceOf(PluralAttributeMapping.class));
tableGroupConsumer.accept(joinedGroup);
}
Aggregations