File tree Expand file tree Collapse file tree 2 files changed +29
-4
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 +29
-4
lines changed Original file line number Diff line number Diff line change @@ -195,22 +195,22 @@ public QueryTokenStream visitCycleClause(HqlParser.CycleClauseContext ctx) {
195
195
QueryRendererBuilder builder = QueryRenderer .builder ();
196
196
197
197
builder .append (QueryTokens .expression (ctx .CYCLE ().getText ()));
198
- builder .append (visit (ctx .cteAttributes ()));
198
+ builder .appendExpression (visit (ctx .cteAttributes ()));
199
199
builder .append (QueryTokens .expression (ctx .SET ().getText ()));
200
- builder .append (visit (ctx .identifier (0 )));
200
+ builder .appendExpression (visit (ctx .identifier (0 )));
201
201
202
202
if (ctx .TO () != null ) {
203
203
204
204
builder .append (QueryTokens .expression (ctx .TO ().getText ()));
205
205
builder .append (visit (ctx .literal (0 )));
206
206
builder .append (QueryTokens .expression (ctx .DEFAULT ().getText ()));
207
- builder .append (visit (ctx .literal (1 )));
207
+ builder .appendExpression (visit (ctx .literal (1 )));
208
208
}
209
209
210
210
if (ctx .USING () != null ) {
211
211
212
212
builder .append (QueryTokens .expression (ctx .USING ().getText ()));
213
- builder .append (visit (ctx .identifier (1 )));
213
+ builder .appendExpression (visit (ctx .identifier (1 )));
214
214
}
215
215
216
216
return builder ;
Original file line number Diff line number Diff line change @@ -1730,6 +1730,31 @@ WITH maxId AS (select max(sr.snapshot.id) snapshotId from SnapshotReference sr
1730
1730
""" );
1731
1731
}
1732
1732
1733
+ @ Test // GH-4012
1734
+ void cteWithSearch () {
1735
+
1736
+ assertQuery ("""
1737
+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o)
1738
+ SEARCH BREADTH FIRST BY foo ASC NULLS FIRST, bar DESC NULLS LAST SET baz
1739
+ SELECT test_uuid FROM Tree
1740
+ """ );
1741
+ }
1742
+
1743
+ @ Test // GH-4012
1744
+ void cteWithCycle () {
1745
+
1746
+ assertQuery ("""
1747
+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o) CYCLE test_uuid SET circular TO true DEFAULT false
1748
+ SELECT test_uuid FROM Tree
1749
+ """ );
1750
+
1751
+ assertQuery (
1752
+ """
1753
+ WITH Tree AS (SELECT o.uuid AS test_uuid FROM DemoEntity o) CYCLE test_uuid SET circular TO true DEFAULT false USING bar
1754
+ SELECT test_uuid FROM Tree
1755
+ """ );
1756
+ }
1757
+
1733
1758
@ Test // GH-2982
1734
1759
void floorShouldBeValidEntityName () {
1735
1760
You can’t perform that action at this time.
0 commit comments