Is Postgresql INOUT REFCURSOR Supported?

Does latest hibernate codebase supports INOUT REFCURSOR as parameter to a function?
I tried below function to execute by putting it in org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest

CREATE OR REPLACE FUNCTION public.cursor_func(
	INOUT c1 refcursor)
    RETURNS refcursor   
AS $$
  BEGIN    OPEN c1 FOR SELECT * FROM phone;    END; 
$$ LANGUAGE plpgsql;;

And it throws below exception:

org.hibernate.NotYetImplementedFor6Exception: org.hibernate.procedure.internal.ProcedureParameterImpl
	at app//org.hibernate.procedure.internal.ProcedureParameterImpl.getParameterBinder(ProcedureParameterImpl.java:191)
	at app//org.hibernate.procedure.internal.ProcedureParameterImpl.toJdbcParameterRegistration(ProcedureParameterImpl.java:152)
	at app//org.hibernate.procedure.internal.PostgresCallableStatementSupport.interpretCall(PostgresCallableStatementSupport.java:86)
	at app//org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:589)
	at app//org.hibernate.procedure.internal.ProcedureCallImpl.getOutputs(ProcedureCallImpl.java:564)
	at app//org.hibernate.procedure.internal.ProcedureCallImpl.outputs(ProcedureCallImpl.java:854)
	at app//org.hibernate.procedure.internal.ProcedureCallImpl.execute(ProcedureCallImpl.java:838)
	at app//org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.lambda$testStoredProcedureINOUTRefCursor$25(PostgreSQLStoredProcedureTest.java:290)
	at app//org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:256)
	at app//org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:297)
	at app//org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.testStoredProcedureINOUTRefCursor(PostgreSQLStoredProcedureTest.java:284)
	at java.base@17.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@17.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base@17.0.2/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@17.0.2/java.lang.reflect.Method.invoke(Method.java:568)
	at app//org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at app//org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at app//org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at app//org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45)
	at app//org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at app//org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at app//org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at app//org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
	at app//org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
	at java.base@17.0.2/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base@17.0.2/java.lang.Thread.run(Thread.java:833)

Is REFCURSOR as INOUT parameter to function in the roadmap? How can we provide custom support for functions taking REFCURSOR as INOUT parameter?

Thanks,

Hey, thanks for trying this out. We don’t have it on our radar right now, but we would be very grateful if you could create a JIRA issue for this, contribute the test you wrote and maybe even work on a fix for this :slight_smile:

Sure. Let me refine the test case little further and start planning to work on this.

Thanks for your reply.