File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -605,7 +605,7 @@ dealingWithNullExpression
605605
606606// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-like-predicate
607607stringPatternMatching
608- : expression NOT ? (LIKE | ILIKE ) expression (ESCAPE (character |parameter))?
608+ : expression NOT ? (LIKE | ILIKE ) expression (ESCAPE (stringLiteral |parameter))?
609609 ;
610610
611611// 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];
10781078
10791079
10801080CHARACTER : ' \' ' (~ (' \' ' | ' \\ ' )) ' \' ' ;
1081- STRINGLITERAL : ' \' ' (' \' ' ' \' ' | ~(' \' ' | ' \\ ' ))* ' \' ' ;
1081+ STRINGLITERAL : ' \' ' (' \' ' ' \' ' | ~(' \' ' ))* ' \' ' ;
10821082JAVASTRINGLITERAL : ' "' ( (' \\ ' [btnfr" ']) | ~('" ' ))* ' " ';
10831083INTEGER_LITERAL : INTEGER_NUMBER (L | B I)? ;
10841084FLOAT_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
22312231if (ctx .ESCAPE () != null ) {
22322232
22332233tokens .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 ()));
22362237} else if (ctx .parameter () != null ) {
22372238tokens .addAll (visit (ctx .parameter ()));
22382239}
Original file line number Diff line number Diff line change @@ -1544,4 +1544,9 @@ void binaryLiteralsShouldWork() {
15441544assertQuery ("SELECT ce.id FROM CalendarEvent ce WHERE ce.value = X'DEADBEEF'" );
15451545assertQuery ("SELECT ce.id FROM CalendarEvent ce WHERE ce.value = x'deadbeef'" );
15461546}
1547+
1548+ @ Test // GH-3040
1549+ void escapeClauseShouldWork () {
1550+ assertQuery ("select t.name from SomeDbo t where t.name LIKE :name escape '\\ \\ '" );
1551+ }
15471552}
You can’t perform that action at this time.
0 commit comments