File tree 5 files changed +43
-12
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
5 files changed +43
-12
lines changed Original file line number Diff line number Diff line change @@ -713,6 +713,7 @@ reservedWord
713
713
| FETCH
714
714
| FILTER
715
715
| FIRST
716
+ | FLOOR
716
717
| FOLLOWING
717
718
| FOR
718
719
| FORMAT
Original file line number Diff line number Diff line change @@ -596,12 +596,13 @@ trim_character
596
596
597
597
identification_variable
598
598
: IDENTIFICATION_VARIABLE
599
- | ORDER // Gap in the spec requires supporting 'Order' as an entity name
600
- | COUNT // Gap in the spec requires supporting 'count' as a possible name
601
- | KEY // Gap in the sepc requires supported 'key' as a possible name
602
- | LEFT
599
+ | f=(COUNT
603
600
| INNER
601
+ | KEY
602
+ | LEFT
603
+ | ORDER
604
604
| OUTER
605
+ | FLOOR )
605
606
;
606
607
607
608
constructor_name
@@ -682,8 +683,7 @@ collection_value_field
682
683
;
683
684
684
685
entity_name
685
- : identification_variable
686
- | identification_variable (' .' identification_variable)* // Hibernate sometimes expands the entity name to FQDN when using named queries
686
+ : identification_variable (' .' identification_variable)* // Hibernate sometimes expands the entity name to FQDN when using named queries
687
687
;
688
688
689
689
result_variable
Original file line number Diff line number Diff line change @@ -2118,12 +2118,8 @@ public List<JpaQueryParsingToken> visitIdentification_variable(JpqlParser.Identi
2118
2118
2119
2119
if (ctx .IDENTIFICATION_VARIABLE () != null ) {
2120
2120
return List .of (new JpaQueryParsingToken (ctx .IDENTIFICATION_VARIABLE ()));
2121
- } else if (ctx .COUNT () != null ) {
2122
- return List .of (new JpaQueryParsingToken (ctx .COUNT ()));
2123
- } else if (ctx .ORDER () != null ) {
2124
- return List .of (new JpaQueryParsingToken (ctx .ORDER ()));
2125
- } else if (ctx .KEY () != null ) {
2126
- return List .of (new JpaQueryParsingToken (ctx .KEY ()));
2121
+ } else if (ctx .f != null ) {
2122
+ return List .of (new JpaQueryParsingToken (ctx .f ));
2127
2123
} else {
2128
2124
return List .of ();
2129
2125
}
Original file line number Diff line number Diff line change @@ -1499,4 +1499,21 @@ WITH maxId AS(select max(sr.snapshot.id) snapshotId from SnapshotReference sr
1499
1499
select sr from maxId m join SnapshotReference sr on sr.snapshot.id = m.snapshotId
1500
1500
""" );
1501
1501
}
1502
+
1503
+ @ Test // GH-2982
1504
+ void floorShouldBeValidEntityName () {
1505
+
1506
+ assertQuery ("""
1507
+ SELECT f
1508
+ FROM Floor f
1509
+ WHERE f.name = :name
1510
+ """ );
1511
+
1512
+ assertQuery ("""
1513
+ SELECT r
1514
+ FROM Room r
1515
+ JOIN r.floor f
1516
+ WHERE f.name = :name
1517
+ """ );
1518
+ }
1502
1519
}
Original file line number Diff line number Diff line change @@ -914,4 +914,21 @@ void theRest38() {
914
914
WHERE l.product.name = ?1
915
915
""" );
916
916
}
917
+
918
+ @ Test // GH-2982
919
+ void floorShouldBeValidEntityName () {
920
+
921
+ assertQuery ("""
922
+ SELECT f
923
+ FROM Floor f
924
+ WHERE f.name = :name
925
+ """ );
926
+
927
+ assertQuery ("""
928
+ SELECT r
929
+ FROM Room r
930
+ JOIN r.floor f
931
+ WHERE f.name = :name
932
+ """ );
933
+ }
917
934
}
You can’t perform that action at this time.
0 commit comments