Skip to content

Commit 2eaa6d5

Browse files
coderestingmp911de
authored andcommitted
Fix Hql-Queries using CEILING and LN.
Closes #3711
1 parent f4e2fa7 commit 2eaa6d5

File tree

2 files changed

+14
-2
lines changed
  • spring-data-jpa/src

2 files changed

+14
-2
lines changed

spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ grammar Hql;
2525
* management of complex rules in the generated Visitor. Finally, there are labels applied to rule elements (op=('+'|'-')
2626
* to simplify the processing.
2727
*
28-
* @author Greg Turnquist
28+
* @author Greg Turnquist, Yannick Brandt
2929
* @since 3.1
3030
*/
3131
}
@@ -1133,6 +1133,7 @@ reservedWord
11331133
| BY
11341134
| CASE
11351135
| CAST
1136+
| CEILING
11361137
| COLLATE
11371138
| CONTAINS
11381139
| COUNT
@@ -1206,6 +1207,7 @@ reservedWord
12061207
| LIMIT
12071208
| LIST
12081209
| LISTAGG
1210+
| LN
12091211
| LOCAL
12101212
| LOCAL_DATE
12111213
| LOCAL_DATETIME

spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlQueryRendererTests.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
* @author Greg Turnquist
3939
* @author Christoph Strobl
40-
* @author Mark Paluch
40+
* @author Mark Paluch, Yannick Brandt
4141
* @since 3.1
4242
*/
4343
class HqlQueryRendererTests {
@@ -1509,6 +1509,16 @@ select round(count(ri) * 100 / max(ri.receipt.positions), 0) as perc
15091509
});
15101510
}
15111511

1512+
@Test
1513+
void ceilingFunctionShouldWork() {
1514+
assertQuery("select ceiling(1.5) from Element a");
1515+
}
1516+
1517+
@Test
1518+
void lnFunctionSouldWork() {
1519+
assertQuery("select ln(7.5) from Element a");
1520+
}
1521+
15121522
@Test // GH-2981
15131523
void cteWithClauseShouldWork() {
15141524

0 commit comments

Comments
 (0)