HHH-13944 HQL/JPQL size() does not work (anymore) with nested expression

This commit is contained in:
Andrea Boriero 2020-12-02 15:07:18 +01:00 committed by Gail Badner
parent c99904a606
commit 20008b19bc
2 changed files with 9 additions and 2 deletions

View File

@ -68,6 +68,7 @@ tokens
private boolean inFrom = false;
private boolean inCount = false;
private boolean inCountDistinct = false;
private boolean inSize = false;
private int statementType;
private String statementTypeName;
@ -108,6 +109,10 @@ tokens
return inCountDistinct;
}
public final boolean isInSize() {
return inSize;
}
public final int getStatementType() {
return statementType;
}
@ -691,8 +696,9 @@ collectionFunction
;
functionCall
: #( COLL_SIZE path:collectionPath ) {
: #( COLL_SIZE {inSize=true;} path:collectionPath ) {
#functionCall = createCollectionSizeFunction( #path, inSelect );
inSize=false;
}
| #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (exprOrSubquery [ null ])* ) )? ) {
processFunction( #functionCall, inSelect );

View File

@ -417,7 +417,8 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
joinIsNeeded = generateJoin;
}
else {
joinIsNeeded = generateJoin || ( getWalker().isInSelect() || getWalker().isInFrom() );
joinIsNeeded = generateJoin
|| ( getWalker().isInSelect() || getWalker().isInFrom() || ( implicitJoin && getWalker().isInSize() ) );
}
if ( joinIsNeeded ) {