File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
main/java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ public QueryTokenStream visitCteAttributes(HqlParser.CteAttributesContext ctx) {
131131 return QueryTokenStream .concat (ctx .identifier (), this ::visit , TOKEN_COMMA );
132132 }
133133
134+ @ Override
135+ public QueryTokenStream visitSearchSpecifications (HqlParser .SearchSpecificationsContext ctx ) {
136+ return QueryTokenStream .concat (ctx .searchSpecification (), this ::visit , TOKEN_COMMA );
137+ }
138+
134139 @ Override
135140 public QueryTokenStream visitOrderedQuery (HqlParser .OrderedQueryContext ctx ) {
136141
Original file line number Diff line number Diff line change @@ -2097,6 +2097,31 @@ WITH maxId AS (select max(sr.snapshot.id) snapshotId from SnapshotReference sr
20972097 """ );
20982098 }
20992099
2100+ @ Test // GH-4012
2101+ void cteWithSearch () {
2102+
2103+ assertQuery ("""
2104+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o)
2105+ SEARCH BREADTH FIRST BY foo ASC NULLS FIRST, bar DESC NULLS LAST SET baz
2106+ SELECT test_uuid FROM Tree
2107+ """ );
2108+ }
2109+
2110+ @ Test // GH-4012
2111+ void cteWithCycle () {
2112+
2113+ assertQuery ("""
2114+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o) CYCLE test_uuid SET circular TO true DEFAULT false
2115+ SELECT test_uuid FROM Tree
2116+ """ );
2117+
2118+ assertQuery (
2119+ """
2120+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o) CYCLE test_uuid SET circular TO true DEFAULT false USING bar
2121+ SELECT test_uuid FROM Tree
2122+ """ );
2123+ }
2124+
21002125 @ Test // GH-2982
21012126 void floorShouldBeValidEntityName () {
21022127
You can’t perform that action at this time.
0 commit comments