File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 2929/**
3030 * An ANTLR {@link org.antlr.v4.runtime.tree.ParseTreeVisitor} that renders an HQL query without making any changes.
3131 *
32+ * @author TaeHyun Kang(polyglot-k)
3233 * @author Greg Turnquist
3334 * @author Christoph Strobl
3435 * @since 3.1
@@ -43,19 +44,20 @@ class HqlQueryRenderer extends HqlBaseVisitor<QueryTokenStream> {
4344 */
4445 static boolean isSubquery (ParserRuleContext ctx ) {
4546
46- if (ctx instanceof HqlParser . SubqueryContext || ctx instanceof HqlParser . CteContext ) {
47- return true ;
48- } else if ( ctx instanceof HqlParser . SelectStatementContext ) {
49- return false ;
50- } else if (ctx instanceof HqlParser .InsertStatementContext ) {
51- return false ;
52- } else if ( ctx instanceof HqlParser .DeleteStatementContext ) {
53- return false ;
54- } else if ( ctx instanceof HqlParser . UpdateStatementContext ) {
55- return false ;
56- } else {
57- return ctx . getParent () != null && isSubquery ( ctx .getParent () );
47+ while (ctx != null ) {
48+ if ( ctx instanceof HqlParser . SubqueryContext || ctx instanceof HqlParser . CteContext ) {
49+ return true ;
50+ }
51+ if (ctx instanceof HqlParser .SelectStatementContext ||
52+ ctx instanceof HqlParser . InsertStatementContext ||
53+ ctx instanceof HqlParser .DeleteStatementContext ||
54+ ctx instanceof HqlParser . UpdateStatementContext
55+ ) {
56+ return false ;
57+ }
58+ ctx = ctx .getParent ();
5859 }
60+ return false ;
5961 }
6062
6163 @ Override
You can’t perform that action at this time.
0 commit comments