HHH-18556 Add test for issue
This commit is contained in:
parent
63dde7dc09
commit
8efcf26b37
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
|
import org.hibernate.testing.orm.junit.JiraKey;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
@ -55,6 +56,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")
|
@Entity(name = "Person")
|
||||||
@Table(name = "PERSON_TABLE")
|
@Table(name = "PERSON_TABLE")
|
||||||
public static class Person {
|
public static class Person {
|
||||||
|
|
Loading…
Reference in New Issue