HHH-8671 WithClauseTest.testWithClause fails on all QA databases

This commit is contained in:
Strong Liu 2013-11-06 10:19:29 +08:00
parent e012809fb2
commit 3b85ae8658
2 changed files with 17 additions and 15 deletions

View File

@ -208,7 +208,7 @@ public class JoinSequence {
condition = on;
}
if ( withClauseFragment != null ) {
if ( withClauseFragment != null && !isManyToManyRoot( join.joinable )) {
condition += " and " + withClauseFragment;
}

View File

@ -23,6 +23,8 @@
*
*/
package org.hibernate.hql.internal.ast.util;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Stack;
import antlr.collections.AST;
@ -65,24 +67,24 @@ public class NodeTraverser {
}
visitDepthFirst( ast.getFirstChild() );
}
private void visitDepthFirst(AST ast){
if(ast==null){
private void visitDepthFirst(AST ast) {
if ( ast == null ) {
return;
}
Stack stack = new Stack();
if ( ast != null ) {
stack.push( ast );
while (!stack.empty()) {
ast = (AST) stack.pop();
strategy.visit( ast );
if ( ast.getNextSibling() != null )
stack.push( ast.getNextSibling() );
if ( ast.getFirstChild() != null )
stack.push( ast.getFirstChild() );
Deque<AST> stack = new ArrayDeque<AST>();
stack.addLast( ast );
while ( !stack.isEmpty() ) {
ast = stack.removeLast();
strategy.visit( ast );
if ( ast.getNextSibling() != null ) {
stack.addLast( ast.getNextSibling() );
}
if ( ast.getFirstChild() != null ) {
stack.addLast( ast.getFirstChild() );
}
}
}
}