There are rules to calling Stored Procedures. They are
1. Only one return value allowed 2. It must be the first out value. 3. The out value must be a reference cursor.
This last one is the difference between what you are seeing in version C. Since you do not have an out parameter Hibernate will have no idea what type of object to create.
you should define also a class tag in your hbm.xml file like this : <hibernate-mapping> <class name="aip.law.orm.hntest.SpHntest"> <id name="id" type="java.lang.Integer"> <column name="ID" /> </id> <property name="caption" type="java.lang.String"> <column name="Caption" length="60" not-null="true" /> </property> <loader query-ref="testingProc" /> </class> <sql-query name="testingProc" callable="true" > <return alias="SpHntest" class="aip.law.orm.hntest.SpHntest"> <return-property name="id" column="ID"/> <return-property name="caption" column="Caption"/> </return> {call sphntest()}
</sql-query> </hibernate-mapping>
Ingoba Ningthoujam
Ranch Hand
Joined: Dec 04, 2006
Posts: 90
posted
0
Hi brotherjain ,
Write a POJO as well as the corresponding mapping file having fields which are returning from the store procedure.
John Grath
Greenhorn
Joined: Sep 18, 2007
Posts: 15
posted
0
On previous projects I have created a Spring managed JDBC service to execute stored procedures and run more complicated bespoke SQL. I find that this approach works best on larger projects.