Execute sybase stored proc from hibernate
- by Padmanabh
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