File tree 3 files changed +40
-2
lines changed
antlr4/org/springframework/data/jpa/repository/query
java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query
3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -686,7 +686,7 @@ character
686
686
;
687
687
688
688
functionName
689
- : reservedWord
689
+ : reservedWord ( ' . ' reservedWord)*
690
690
;
691
691
692
692
reservedWord
Original file line number Diff line number Diff line change @@ -2503,7 +2503,17 @@ public List<JpaQueryParsingToken> visitCharacter(HqlParser.CharacterContext ctx)
2503
2503
2504
2504
@ Override
2505
2505
public List <JpaQueryParsingToken > visitFunctionName (HqlParser .FunctionNameContext ctx ) {
2506
- return visit (ctx .reservedWord ());
2506
+
2507
+ List <JpaQueryParsingToken > tokens = new ArrayList <>();
2508
+
2509
+ ctx .reservedWord ().forEach (reservedWordContext -> {
2510
+ tokens .addAll (visit (reservedWordContext ));
2511
+ NOSPACE (tokens );
2512
+ tokens .add (TOKEN_DOT );
2513
+ });
2514
+ CLIP (tokens );
2515
+
2516
+ return tokens ;
2507
2517
}
2508
2518
2509
2519
@ Override
Original file line number Diff line number Diff line change @@ -1556,4 +1556,32 @@ void typeShouldBeAValidParameter() {
1556
1556
assertQuery ("select e from Employee e where e.type = :_type" );
1557
1557
assertQuery ("select te from TestEntity te where te.type = :type" );
1558
1558
}
1559
+
1560
+ @ Test // GH-3099
1561
+ void functionNamesShouldSupportSchemaScoping () {
1562
+
1563
+ assertQuery ("""
1564
+ SELECT b
1565
+ FROM MyEntity b
1566
+ WHERE b.status = :status
1567
+ AND utl_raw.cast_to_varchar2((nlssort(lower(b.name), 'nls_sort=binary_ai'))) LIKE lower(:name)
1568
+ ORDER BY utl_raw.cast_to_varchar2((nlssort(lower(b.name), 'nls_sort=binary_ai'))) ASC
1569
+ """ );
1570
+
1571
+ assertQuery ("""
1572
+ select b
1573
+ from Bairro b
1574
+ where b.situacao = :situacao
1575
+ and utl_raw.cast_to_varchar2((nlssort(lower(b.nome), 'nls_sort=binary_ai'))) like lower(:nome)
1576
+ order by utl_raw.cast_to_varchar2((nlssort(lower(b.nome), 'nls_sort=binary_ai'))) ASC
1577
+ """ );
1578
+
1579
+ assertQuery ("""
1580
+ select b
1581
+ from Bairro b
1582
+ where b.situacao = :situacao
1583
+ and CTM_UTLRAW_NLSSORT_LOWER(b.nome) like lower(:nome)
1584
+ order by CTM_UTLRAW_NLSSORT_LOWER(b.nome) ASC
1585
+ """ );
1586
+ }
1559
1587
}
You can’t perform that action at this time.
0 commit comments