Joined: Mon Oct 11, 2010 1:09 am Posts: 1
|
I am trying to call a User Defined Function in a Postgres database from Java through Hibernate. I am getting the error message "A CallableStatement was executed with an invalid number of parameters."
My Java code is
SessionFactory sessionFactory = configuration.buildSessionFactory(); Session session = sessionFactory.openSession(); Query query = session.getNamedQuery("validatecwmtest_F"); List<Object> res = query.list();
My Hibernate configuration of the query is
<sql-query name="validatecwmtest_F" callable="true"> <return class="com.stratix.esb.service.dao.hbm.CWMTest"> <return-property name="pkey" column="PKEY"/> <return-property name="acctNum" column="ACCT_NUM"/> </return> { ? = call validatecwmtest() } </sql-query>
The validatecwmtest() user defined function was created with this SQL:
CREATE OR REPLACE FUNCTION validatecwmtest() RETURNS SETOF cwmtest AS $$ SELECT * FROM cwmtest; $$ LANGUAGE SQL;
The table cwmtest was created with this SQL:
CREATE TABLE cwmtest { pkey serial NOT NULL PRIMARY KEY, acct_num varchar(20) NULL }
I would very much appreciate any help anyone can provide to resolve this error. Thanks!
|
|