HHH-8551 - Cannot use with-clause on the RHS of a join
This commit is contained in:
parent
2060e95c40
commit
7c6b358d4f
|
@ -400,16 +400,18 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) LOG.debugf("createFromJoinElement() : %s",
|
if ( LOG.isDebugEnabled() ) {
|
||||||
getASTPrinter().showAsString(fromElement, "-- join tree --"));
|
LOG.debug("createFromJoinElement() : " + getASTPrinter().showAsString(fromElement, "-- join tree --") );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleWithFragment(FromElement fromElement, AST hqlWithNode) throws SemanticException {
|
private void handleWithFragment(FromElement fromElement, AST hqlWithNode) throws SemanticException {
|
||||||
try {
|
try {
|
||||||
withClause( hqlWithNode );
|
withClause( hqlWithNode );
|
||||||
AST hqlSqlWithNode = returnAST;
|
AST hqlSqlWithNode = returnAST;
|
||||||
if (LOG.isDebugEnabled()) LOG.debugf("handleWithFragment() : %s",
|
if ( LOG.isDebugEnabled() ) {
|
||||||
getASTPrinter().showAsString(hqlSqlWithNode, "-- with clause --"));
|
LOG.debug( "handleWithFragment() : " + getASTPrinter().showAsString(hqlSqlWithNode, "-- with clause --") );
|
||||||
|
}
|
||||||
WithClauseVisitor visitor = new WithClauseVisitor( fromElement, queryTranslatorImpl );
|
WithClauseVisitor visitor = new WithClauseVisitor( fromElement, queryTranslatorImpl );
|
||||||
NodeTraverser traverser = new NodeTraverser( visitor );
|
NodeTraverser traverser = new NodeTraverser( visitor );
|
||||||
traverser.traverseDepthFirst( hqlSqlWithNode );
|
traverser.traverseDepthFirst( hqlSqlWithNode );
|
||||||
|
@ -421,8 +423,11 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
||||||
else {
|
else {
|
||||||
FromElement referencedFromElement = visitor.getReferencedFromElement();
|
FromElement referencedFromElement = visitor.getReferencedFromElement();
|
||||||
if ( referencedFromElement != fromElement ) {
|
if ( referencedFromElement != fromElement ) {
|
||||||
LOG.warn( "with-clause expressions do not reference the from-clause element to which the with-clause was associated. The query may not work as expected..."
|
LOG.warnf(
|
||||||
+ queryTranslatorImpl.getQueryString() );
|
"with-clause expressions do not reference the from-clause element to which the " +
|
||||||
|
"with-clause was associated. The query may not work as expected [%s]",
|
||||||
|
queryTranslatorImpl.getQueryString()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue