File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -705,18 +705,22 @@ subtype
705705
706706collection_valued_field
707707 : identification_variable
708+ | reserved_word
708709 ;
709710
710711single_valued_object_field
711712 : identification_variable
713+ | reserved_word
712714 ;
713715
714716state_field
715717 : identification_variable
718+ | reserved_word
716719 ;
717720
718721collection_value_field
719722 : identification_variable
723+ | reserved_word
720724 ;
721725
722726entity_name
Original file line number Diff line number Diff line change @@ -2317,21 +2317,41 @@ public QueryTokenStream visitSubtype(EqlParser.SubtypeContext ctx) {
23172317
23182318 @ Override
23192319 public QueryTokenStream visitCollection_valued_field (EqlParser .Collection_valued_fieldContext ctx ) {
2320+
2321+ if (ctx .reserved_word () != null ) {
2322+ return visit (ctx .reserved_word ());
2323+ }
2324+
23202325 return visit (ctx .identification_variable ());
23212326 }
23222327
23232328 @ Override
23242329 public QueryTokenStream visitSingle_valued_object_field (EqlParser .Single_valued_object_fieldContext ctx ) {
2330+
2331+ if (ctx .reserved_word () != null ) {
2332+ return visit (ctx .reserved_word ());
2333+ }
2334+
23252335 return visit (ctx .identification_variable ());
23262336 }
23272337
23282338 @ Override
23292339 public QueryTokenStream visitState_field (EqlParser .State_fieldContext ctx ) {
2340+
2341+ if (ctx .reserved_word () != null ) {
2342+ return visit (ctx .reserved_word ());
2343+ }
2344+
23302345 return visit (ctx .identification_variable ());
23312346 }
23322347
23332348 @ Override
23342349 public QueryTokenStream visitCollection_value_field (EqlParser .Collection_value_fieldContext ctx ) {
2350+
2351+ if (ctx .reserved_word () != null ) {
2352+ return visit (ctx .reserved_word ());
2353+ }
2354+
23352355 return visit (ctx .identification_variable ());
23362356 }
23372357
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ void selectClause() {
7272
7373 assertQuery ("SELECT COUNT(e) FROM Employee e" );
7474 assertQuery ("SELECT MAX(e.salary) FROM Employee e" );
75+ assertQuery ("select sum(i.size.foo.bar.new) from Item i" );
7576 assertQuery ("SELECT NEW com.acme.reports.EmpReport(e.firstName, e.lastName, e.salary) FROM Employee e" );
7677 }
7778
@@ -342,8 +343,11 @@ void specialOperators() {
342343 assertQuery ("SELECT toDo FROM Employee e JOIN e.toDoList toDo WHERE INDEX(toDo) = 1" );
343344 assertQuery ("SELECT p FROM Employee e JOIN e.priorities p WHERE KEY(p) = 'high'" );
344345 assertQuery ("SELECT e FROM Employee e WHERE SIZE(e.managedEmployees) < 2" );
346+ assertQuery ("SELECT e FROM Employee e WHERE SIZE(e.managedEmployees.new) < 2" );
345347 assertQuery ("SELECT e FROM Employee e WHERE e.managedEmployees IS EMPTY" );
348+ assertQuery ("SELECT e FROM Employee e WHERE e.managedEmployee.size.new IS EMPTY" );
346349 assertQuery ("SELECT e FROM Employee e WHERE 'write code' MEMBER OF e.responsibilities" );
350+ assertQuery ("SELECT e FROM Employee e WHERE 'write code' MEMBER OF e.responsibilities.size" );
347351 assertQuery ("SELECT p FROM Project p WHERE TYPE(p) = LargeProject" );
348352
349353 /**
You can’t perform that action at this time.
0 commit comments