From 7d0f313efe1d1af0c4b5957f7331872ba0fe370f Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Mon, 12 Jun 2023 11:46:54 +0200 Subject: [PATCH] HHH-16767 From#getJoins throws exception if non-attribute was joined --- .../org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java | 2 +- .../java/org/hibernate/orm/test/query/hql/FromClauseTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java index ad72b325e1..159667fe87 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/AbstractSqmFrom.java @@ -320,7 +320,7 @@ public abstract class AbstractSqmFrom extends AbstractSqmPath implements public Set> getJoins() { //noinspection unchecked return (Set>) (Set) getSqmJoins().stream() - .filter( sqmJoin -> ! ( sqmJoin instanceof SqmAttributeJoin && ( (SqmAttributeJoin) sqmJoin ).isFetched() ) ) + .filter( sqmJoin -> sqmJoin instanceof SqmAttributeJoin && !( (SqmAttributeJoin) sqmJoin ).isFetched() ) .collect( Collectors.toSet() ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java index f1a9d41dc0..7d7bce5491 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java @@ -109,7 +109,7 @@ public class FromClauseTests extends BaseSqmUnitTest { final SqmRoot sqmRoot = fromClause.getRoots().get( 0 ); assertThat( sqmRoot, notNullValue() ); assertThat( sqmRoot.getExplicitAlias(), is( "p" ) ); - assertThat( sqmRoot.getJoins(), hasSize( 1 ) ); + assertThat( sqmRoot.getSqmJoins(), hasSize( 1 ) ); assertThat( sqmRoot.getSqmJoins().get( 0 ).getExplicitAlias(), is( "p2" ) ); }