File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
hibernate-core/src/main/java/org/hibernate/query/sqm/sql Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1989,6 +1989,8 @@ public QueryGroup visitQueryGroup(SqmQueryGroup<?> queryGroup) {
19891989 (SqmAliasedNodeCollector ) lastPoppedProcessingState .getSqlExpressionResolver ()
19901990 );
19911991
1992+ final FromClauseIndex firstQueryPartIndex = lastPoppedFromClauseIndex ;
1993+
19921994 visitOrderByOffsetAndFetch ( queryGroup , group );
19931995
19941996 trackSelectionsForGroup = false ;
@@ -1997,6 +1999,10 @@ public QueryGroup visitQueryGroup(SqmQueryGroup<?> queryGroup) {
19971999 newQueryParts .add ( visitQueryPart ( queryParts .get ( i ) ) );
19982000 }
19992001
2002+ // Register the table groups from the first sub-queryspec's FromClauseIndex
2003+ // as they might be needed to resolve the tuple type's table groups
2004+ firstQueryPartIndex .copyInto ( fromClauseIndexStack .getCurrent () );
2005+
20002006 return group ;
20012007 }
20022008 finally {
Original file line number Diff line number Diff line change 77import java .util .HashMap ;
88import java .util .Map ;
99
10+ import org .hibernate .Internal ;
1011import org .hibernate .spi .NavigablePath ;
1112import org .hibernate .query .sqm .tree .domain .SqmPath ;
1213import org .hibernate .query .sqm .tree .from .SqmAttributeJoin ;
@@ -89,4 +90,9 @@ public boolean isResolved(SqmFrom fromElement) {
8990 public SqmAttributeJoin findFetchedJoinByPath (NavigablePath path ) {
9091 return fetchesByPath == null ? null : fetchesByPath .get ( path .getIdentifierForTableGroup () );
9192 }
93+
94+ @ Internal
95+ public void copyInto (FromClauseIndex index ) {
96+ index .tableGroupMap .putAll ( tableGroupMap );
97+ }
9298}
You can’t perform that action at this time.
0 commit comments