Execute sybase stored proc from hibernate
Posted
by Padmanabh
on Stack Overflow
See other posts from Stack Overflow
or by Padmanabh
Published on 2010-03-26T03:39:16Z
Indexed on
2010/03/26
3:43 UTC
Read the original article
Hit count: 360
hibernate
|stored-procedures
I am having issues with executing a simple sybase stored proc from hibernate. The procedure takes some input and returns one record. I tried with the following tag in hibernate mappings file and java code.
<hibernate-mapping>
<sql-query name="sybaseproc" callable="true">
<return class="Myentity">
<return-property name="next" column="next"/>
</return>
{ ? = call nextnum(?,?) }
</sql-query>
</hibernate-mapping>
java code is as follows
Query q = session.getNamedQuery("sybaseproc");
q.setString(0,"test");
q.setInteger(1,new Integer(10));
Myentity entity = (Myentity) q.uniqueResult();
When I run my test. I get a error saying "Errors in Named Query sybaseproc" and the test does not run. Any help is appreciated.
Thanks
Padmanabh
© Stack Overflow or respective owner