-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Function Call Yields CallableStatement Error
PostPosted: Mon Oct 11, 2010 1:26 am 
Newbie

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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.