allow parameter in like escape

as required by JPQL
This commit is contained in:
Gavin 2022-01-03 17:00:21 +01:00 committed by Gavin King
parent b55ccabba1
commit 4e0c131a27
2 changed files with 13 additions and 1 deletions

View File

@ -424,7 +424,7 @@ inList
;
likeEscape
: ESCAPE STRING_LITERAL
: ESCAPE (STRING_LITERAL | parameter)
;

View File

@ -99,6 +99,18 @@ public class ILikeTest {
);
}
@Test
public void testLikeEscapeParam(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
Query q = session.createQuery( "from BasicEntity be where be.data like 'Pr%$_%' escape :esc" )
.setParameter("esc", "$");
List l = q.getResultList();
assertEquals( 2, l.size() );
}
);
}
@Test
public void testNotLikeEscape(SessionFactoryScope scope) {
scope.inTransaction(