HHH-18556 Add test for issue

This commit is contained in:
Andrea Boriero 2024-09-11 15:37:31 +02:00 committed by Andrea Boriero
parent f80ba1fe22
commit c56d413bf2
1 changed files with 24 additions and 0 deletions

View File

@ -55,6 +55,30 @@ public class SelectCaseWhenNullLiteralTest {
);
}
@Test
@JiraKey( "HHH-18556" )
public void testSelectCaseWhenNullLiteralWithParameters(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
List result = session.createQuery( "select case when 1=1 then ?1 else null end from Person p" )
.setParameter( 1, 2 )
.list();
assertThat( result.size(), is( 1 ) );
assertThat( result.get( 0 ), is( 2 ) );
}
);
scope.inTransaction(
session -> {
List result = session.createQuery( "select count(case when 1=1 then ?1 else null end) from Person p" )
.setParameter( 1, 2 )
.list();
assertThat( result.size(), is( 1 ) );
assertThat( result.get( 0 ), is( 1L ) );
}
);
}
@Entity(name = "Person")
@Table(name = "PERSON_TABLE")
public static class Person {