PostgreSQL*ProcedureTest.testProcedureWithJDBCByName fails with EnterpriseDB

Description

PostgreSQLStoredProcedureTest.testProcedureWithJDBCByName
PostgreSQLFunctionProcedureTest.testFunctionWithJDBCByName

fail with similar error using named parameters:

java.lang.AssertionError: expected:<class java.sql.SQLFeatureNotSupportedException> but was:<class com.edb.util.PSQLException>
com.edb.util.PSQLException: A CallableStatement has a named parameter undefined in the calling statement. Parameter: phoneCount at com.edb.jdbc.PgCallableStatement.getNamedParameterIndex(PgCallableStatement.java:1152) ~[edb-jdbc-42.5.0.1.jar:42.5.0.1-SNAPSHOT] at com.edb.jdbc.PgCallableStatement.registerOutParameter(PgCallableStatement.java:831) ~[edb-jdbc-42.5.0.1.jar:42.5.0.1-SNAPSHOT] at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.lambda$testProcedureWithJDBCByName$5(PostgreSQLStoredProcedureTest.java:221) ~[test/:?] at org.hibernate.jdbc.WorkExecutor.executeReturningWork(WorkExecutor.java:56) ~[main/:?] at org.hibernate.internal.AbstractSharedSessionContract.lambda$doReturningWork$6(AbstractSharedSessionContract.java:973) ~[main/:?] at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:290) ~[main/:?] at org.hibernate.internal.AbstractSharedSessionContract.doWork(AbstractSharedSessionContract.java:977) ~[main/:?] at org.hibernate.internal.AbstractSharedSessionContract.doReturningWork(AbstractSharedSessionContract.java:973) ~[main/:?] at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.lambda$testProcedureWithJDBCByName$6(PostgreSQLStoredProcedureTest.java:217) ~[test/:?] at org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:258) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT] at org.hibernate.testing.transaction.TransactionUtil.doInJPA(TransactionUtil.java:299) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT] at org.hibernate.orm.test.procedure.PostgreSQLStoredProcedureTest.testProcedureWithJDBCByName(PostgreSQLStoredProcedureTest.java:214) [test/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) [junit-4.13.2.jar:4.13.2] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.13.2.jar:4.13.2] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) [junit-4.13.2.jar:4.13.2] at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:45) [hibernate-testing-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.13.2.jar:4.13.2] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.13.2.jar:4.13.2] at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.13.2.jar:4.13.2] at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299) [junit-4.13.2.jar:4.13.2] at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293) [junit-4.13.2.jar:4.13.2] at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?] at java.lang.Thread.run(Thread.java:829) [?:?]


while PostgreSQLFunctionProcedureTest could be fixed by referencing parameters in query
sp_count_phones(?,?)call sp_count_phones(phoneCount=>?,personId=>?)

I didn’t find a similar syntax for PostgreSQLFunctionProcedureTest.

Activity

Show:

Martin Simka March 22, 2023 at 1:42 PM

Description updated with PSQLException stack trace. Just {call sp_count_phones(?,?)} without listing parameter names doesn’t work.

Christian Beikov March 22, 2023 at 12:50 PM

Are you saying that the EDB driver supports named parameters on CallableStatement, or is it just that it throws a different error? Can you please post the stack trace?

As far as I understand the JDBC specification, a query like {call sp_count_phones(?,?)} should allow using named parameters, where the names should refer to the parameter names of the stored procedure parameters as specified in the stored procedure definition.

Details

Assignee

Reporter

Components

Affects versions

Priority

Created March 21, 2023 at 2:48 PM
Updated March 22, 2023 at 1:42 PM