Hello
I am using hibernate 3.0.5. I wrote a simple stored procedure which returns data from multiple tables. How can I get this data and how to do the mappings? I referred to documentation 16.2.2 but still not able solve the problem.
Procedure is as follows:
CREATE PROCEDURE selectEmpDepts (@id numeric(19,0))
RETURNS TABLE
AS
RETURN (SELECT EMP_Name, DEPT_ID FROM T_EMP e, T_EMP_DEPT d WHERE e.empId = d.empId)
I mentioned following in hbm.xml
<sql-query name="selectEmpDepts _SP" callable="true">
<return alias="ps" class="?????????????">
<return-property name="EMP_Name" column="EMP_NAME"/>
<return-property name="DEPT_ID" column="DEPT_ID"/>
</return>
{ ? = call selectEmpDepts (?) }
What should I mention in class attribute? Here this proc basically selects columns from different tables. and each class is mapped to each diff table.
I am using following stmt to run this code List lst = session.getNamedQuery("selectEmpDepts _SP").setInteger(1,3).list();
Is it correct way of doing it?
Appreaciate your help
Thank you
|