HHH-15745 Add test for issue

This commit is contained in:
Marco Belladelli 2022-12-06 17:33:47 +01:00 committed by Christian Beikov
parent c105c34976
commit 1109dfbb1c
1 changed files with 19 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package org.hibernate.orm.test.query.hql;
import org.hibernate.query.SemanticException;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
@ -53,6 +54,24 @@ public class LikeEscapeParameterTest {
);
}
@Test
@TestForIssue(jiraKey = "HHH-15745")
public void testStringLiteralInSubQuery(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
session.createQuery(
"select s from TestEntity s where s.name like ?1 escape '\\'" +
" or s in (" +
" select distinct t.id from TestEntity t where t.name like ?2 escape '\\'" +
" )",
TestEntity.class
)
.setParameter( 1, "%Foo" )
.setParameter( 2, "Bar%" );
}
);
}
@Test
public void testInvalidStringLiteral(SessionFactoryScope scope) {
scope.inTransaction(