Skip to content

Commit 8cae8cd

Browse files
committed
Handle SIGN function properly in HQL and JPQL queries.
See #2994.
1 parent 48cb338 commit 8cae8cd

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,6 @@ SEARCH : S E A R C H;
10131013
SECOND : S E C O N D;
10141014
SELECT : S E L E C T;
10151015
SET : S E T;
1016-
SIGN : S I G N;
10171016
SIZE : S I Z E;
10181017
SOME : S O M E;
10191018
SUBSTRING : S U B S T R I N G;

Diff for: spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Jpql.g4

+2-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ identification_variable
602602
| LEFT
603603
| ORDER
604604
| OUTER
605-
| FLOOR)
605+
| FLOOR
606+
| SIGN)
606607
;
607608

608609
constructor_name

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

+5
Original file line numberDiff line numberDiff line change
@@ -1516,4 +1516,9 @@ void floorShouldBeValidEntityName() {
15161516
WHERE f.name = :name
15171517
""");
15181518
}
1519+
1520+
@Test // GH-2994
1521+
void queryWithSignShouldWork() {
1522+
assertQuery("select t.sign from TestEntity t");
1523+
}
15191524
}

Diff for: spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpqlQueryRendererTests.java

+5
Original file line numberDiff line numberDiff line change
@@ -931,4 +931,9 @@ void floorShouldBeValidEntityName() {
931931
WHERE f.name = :name
932932
""");
933933
}
934+
935+
@Test // GH-2994
936+
void queryWithSignShouldWork() {
937+
assertQuery("select t.sign from TestEntity t");
938+
}
934939
}

0 commit comments

Comments
 (0)