Skip to content

Commit 00209bb

Browse files
committed
HHH-17255 Fix treated join basic path table reference resolution
1 parent 5b404f1 commit 00209bb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

hibernate-core/src/main/java/org/hibernate/query/sqm/sql/internal/BasicValuedPathInterpretation.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ public static <T> BasicValuedPathInterpretation<T> from(
4444
SqmBasicValuedSimplePath<T> sqmPath,
4545
SqmToSqlAstConverter sqlAstCreationState,
4646
boolean jpaQueryComplianceEnabled) {
47-
final FromClauseAccess fromClauseAccess = sqlAstCreationState.getFromClauseAccess();
48-
final TableGroup tableGroup = fromClauseAccess.getTableGroup( sqmPath.getNavigablePath().getParent() );
49-
5047
final SqmPath<?> lhs = sqmPath.getLhs();
48+
final TableGroup tableGroup = sqlAstCreationState.getFromClauseAccess().getTableGroup( lhs.getNavigablePath() );
5149
EntityMappingType treatTarget = null;
5250
final ModelPartContainer modelPartContainer;
5351
if ( lhs instanceof SqmTreatedPath<?, ?> ) {
@@ -87,7 +85,7 @@ public static <T> BasicValuedPathInterpretation<T> from(
8785
final Clause currentClause = sqlAstCreationState.getCurrentClauseStack().getCurrent();
8886
final SqmQueryPart<?> sqmQueryPart = sqlAstCreationState.getCurrentSqmQueryPart();
8987
if ( ( currentClause == Clause.GROUP || currentClause == Clause.SELECT || currentClause == Clause.ORDER || currentClause == Clause.HAVING )
90-
&& sqmPath.getLhs() instanceof SqmFrom<?, ?>
88+
&& lhs instanceof SqmFrom<?, ?>
9189
&& modelPartContainer.getPartMappingType() instanceof ManagedMappingType
9290
&& sqmQueryPart.isSimpleQueryPart()
9391
&& sqmQueryPart.getFirstQuerySpec().groupByClauseContains( sqmPath.getNavigablePath() ) ) {

0 commit comments

Comments
 (0)