HHH-18556 Add test for issue
This commit is contained in:
parent
f80ba1fe22
commit
c56d413bf2
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue