Skip to content

Commit 407e910

Browse files
committed
Make POWER a valid token as an identifier for JPQL and HQL.
See #3143
1 parent cd5b4e7 commit 407e910

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ reservedWord
812812
| PERCENT
813813
| PLACING
814814
| POSITION
815+
| POWER
815816
| PRECEDING
816817
| QUARTER
817818
| RANGE

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

+1
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ identification_variable
605605
| NEW
606606
| ORDER
607607
| OUTER
608+
| POWER
608609
| FLOOR
609610
| SIGN
610611
| TIME

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

+5
Original file line numberDiff line numberDiff line change
@@ -1600,4 +1600,9 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
16001600
ORDER BY j.id
16011601
""");
16021602
}
1603+
1604+
@Test // GH-3143
1605+
void powerShouldBeLegalInAQuery() {
1606+
assertQuery("select e.power.id from MyEntity e");
1607+
}
16031608
}

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

+5
Original file line numberDiff line numberDiff line change
@@ -983,4 +983,9 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
983983
ORDER BY j.id
984984
""");
985985
}
986+
987+
@Test // GH-3143
988+
void powerShouldBeLegalInAQuery() {
989+
assertQuery("select e.power.id from MyEntity e");
990+
}
986991
}

0 commit comments

Comments
 (0)