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; condition = on;
} }
if ( withClauseFragment != null ) { if ( withClauseFragment != null && !isManyToManyRoot( join.joinable )) {
condition += " and " + withClauseFragment; condition += " and " + withClauseFragment;
} }

View File

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