diff --git a/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4 b/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4 index 36205292b6a..1e80b10fec2 100644 --- a/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4 +++ b/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Hql.g4 @@ -812,6 +812,7 @@ reservedWord | PERCENT | PLACING | POSITION + | POWER | PRECEDING | QUARTER | RANGE diff --git a/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Jpql.g4 b/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Jpql.g4 index 271e9d168b0..637bac6c346 100644 --- a/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Jpql.g4 +++ b/spring-data-jpa/src/main/antlr4/org/springframework/data/jpa/repository/query/Jpql.g4 @@ -605,6 +605,7 @@ identification_variable | NEW | ORDER | OUTER + | POWER | FLOOR | SIGN | TIME diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlQueryRendererTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlQueryRendererTests.java index 0feaf2cddeb..39ce36c6053 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlQueryRendererTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/HqlQueryRendererTests.java @@ -1600,4 +1600,9 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() { ORDER BY j.id """); } + + @Test // GH-3143 + void powerShouldBeLegalInAQuery() { + assertQuery("select e.power.id from MyEntity e"); + } } diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpqlQueryRendererTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpqlQueryRendererTests.java index d738ccac378..403f7ffaed7 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpqlQueryRendererTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/JpqlQueryRendererTests.java @@ -983,4 +983,9 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() { ORDER BY j.id """); } + + @Test // GH-3143 + void powerShouldBeLegalInAQuery() { + assertQuery("select e.power.id from MyEntity e"); + } }