We're updating the issue view to help you get more done. 

Passing null as parameter is not allowed even when enablePassingNulls() has been called

Description

I have set the enablePassingNulls to 'true', but it has thrown an Exception.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 public class StoredProcedureParameterTypeTest extends BaseNonConfigCoreFunctionalTestCase { ... @Test @TestForIssue( jiraKey = "HHH-12905" ) public void testStringTypeInParameterIsNull() { inTransaction( session -> { ProcedureCall procedureCall = session.createStoredProcedureCall("test"); procedureCall.registerParameter(1, StringType.class, ParameterMode.IN).enablePassingNulls(true); procedureCall.setParameter(1, null); } ); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Bind value [null] was not of specified type [class org.hibernate.type.StringType java.lang.IllegalArgumentException: Bind value [null] was not of specified type [class org.hibernate.type.StringType at org.hibernate.procedure.internal.ParameterBindImpl.internalSetValue(ParameterBindImpl.java:83) at org.hibernate.procedure.internal.ParameterBindImpl.setBindValue(ParameterBindImpl.java:64) at org.hibernate.procedure.internal.ProcedureCallImpl.setParameter(ProcedureCallImpl.java:824) at org.hibernate.procedure.internal.ProcedureCallImpl.setParameter(ProcedureCallImpl.java:70) at org.hibernate.test.procedure.StoredProcedureParameterTypeTest.lambda$testStringTypeInParameterIsNull$31(StoredProcedureParameterTypeTest.java:370) at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:57) at org.hibernate.testing.transaction.TransactionUtil2.lambda$inTransaction$0(TransactionUtil2.java:44) at org.hibernate.testing.transaction.TransactionUtil2.inSession(TransactionUtil2.java:29) at org.hibernate.testing.transaction.TransactionUtil2.inTransaction(TransactionUtil2.java:41) at org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase.inTransaction(BaseNonConfigCoreFunctionalTestCase.java:560) at org.hibernate.test.procedure.StoredProcedureParameterTypeTest.testStringTypeInParameterIsNull(StoredProcedureParameterTypeTest.java:366) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298) at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.lang.Thread.run(Thread.java:745)

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Roland Kurucz

Components

Fix versions

Affects versions

5.3.0.Final
5.3.1
5.3.2
5.3.3
5.3.4

Priority

Major