File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
hibernate-core/src/test/java/org/hibernate/orm/test/query Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,30 @@ public void testSelectCaseWhenNullLiteral(SessionFactoryScope scope) {
55
55
);
56
56
}
57
57
58
+ @ Test
59
+ @ JiraKey ( "HHH-18556" )
60
+ public void testSelectCaseWhenNullLiteralWithParameters (SessionFactoryScope scope ) {
61
+ scope .inTransaction (
62
+ session -> {
63
+ List result = session .createQuery ( "select case when 1=1 then ?1 else null end from Person p" )
64
+ .setParameter ( 1 , 2 )
65
+ .list ();
66
+ assertThat ( result .size (), is ( 1 ) );
67
+ assertThat ( result .get ( 0 ), is ( 2 ) );
68
+ }
69
+ );
70
+
71
+ scope .inTransaction (
72
+ session -> {
73
+ List result = session .createQuery ( "select count(case when 1=1 then ?1 else null end) from Person p" )
74
+ .setParameter ( 1 , 2 )
75
+ .list ();
76
+ assertThat ( result .size (), is ( 1 ) );
77
+ assertThat ( result .get ( 0 ), is ( 1L ) );
78
+ }
79
+ );
80
+ }
81
+
58
82
@ Entity (name = "Person" )
59
83
@ Table (name = "PERSON_TABLE" )
60
84
public static class Person {
You can’t perform that action at this time.
0 commit comments