File tree 3 files changed +10
-4
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 +10
-4
lines changed Original file line number Diff line number Diff line change @@ -605,7 +605,7 @@ dealingWithNullExpression
605
605
606
606
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-like-predicate
607
607
stringPatternMatching
608
- : expression NOT ? (LIKE | ILIKE ) expression (ESCAPE (character |parameter))?
608
+ : expression NOT ? (LIKE | ILIKE ) expression (ESCAPE (stringLiteral |parameter))?
609
609
;
610
610
611
611
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-elements-indices
@@ -1078,7 +1078,7 @@ fragment HEX_DIGIT : [0-9a-fA-F];
1078
1078
1079
1079
1080
1080
CHARACTER : ' \' ' (~ (' \' ' | ' \\ ' )) ' \' ' ;
1081
- STRINGLITERAL : ' \' ' (' \' ' ' \' ' | ~(' \' ' | ' \\ ' ))* ' \' ' ;
1081
+ STRINGLITERAL : ' \' ' (' \' ' ' \' ' | ~(' \' ' ))* ' \' ' ;
1082
1082
JAVASTRINGLITERAL : ' "' ( (' \\ ' [btnfr" ']) | ~('" ' ))* ' " ';
1083
1083
INTEGER_LITERAL : INTEGER_NUMBER (L | B I)? ;
1084
1084
FLOAT_LITERAL : FLOAT_NUMBER (D | F | B D)?;
Original file line number Diff line number Diff line change @@ -2231,8 +2231,9 @@ public List<JpaQueryParsingToken> visitStringPatternMatching(HqlParser.StringPat
2231
2231
if (ctx .ESCAPE () != null ) {
2232
2232
2233
2233
tokens .add (new JpaQueryParsingToken (ctx .ESCAPE ()));
2234
- if (ctx .character () != null ) {
2235
- tokens .addAll (visit (ctx .character ()));
2234
+
2235
+ if (ctx .stringLiteral () != null ) {
2236
+ tokens .addAll (visit (ctx .stringLiteral ()));
2236
2237
} else if (ctx .parameter () != null ) {
2237
2238
tokens .addAll (visit (ctx .parameter ()));
2238
2239
}
Original file line number Diff line number Diff line change @@ -1544,4 +1544,9 @@ void binaryLiteralsShouldWork() {
1544
1544
assertQuery ("SELECT ce.id FROM CalendarEvent ce WHERE ce.value = X'DEADBEEF'" );
1545
1545
assertQuery ("SELECT ce.id FROM CalendarEvent ce WHERE ce.value = x'deadbeef'" );
1546
1546
}
1547
+
1548
+ @ Test // GH-3040
1549
+ void escapeClauseShouldWork () {
1550
+ assertQuery ("select t.name from SomeDbo t where t.name LIKE :name escape '\\ \\ '" );
1551
+ }
1547
1552
}
You can’t perform that action at this time.
0 commit comments