How to execute Stored procedure in Hibernate?
You can declare it as Named queiries in one of your mapping files and give unique name.
Call it in your code. Sample code is below.
You can declare it as Named queiries in one of your mapping files and give unique name.
Call it in your code. Sample code is below.
SQLQuery sq (SQLQuery) session.getNamedQuery("findSearchResultsListSP");
sq.addEntity("documentTypeCode" documentTypeCode);
List results sq.list();
<sql-query name="selectAllEmployees_SP" callable="true"> <return alias="emp" class="employee"> <return-property name="empid" column="EMP_ID"/> <return-property name="name" column="EMP_NAME"/> <return-property name="address" column="EMP_ADDRESS"/> { ? = call selectAllEmployees() } </return> </sql-query>--------------------------------------------------------------------------------------------
Comments
Post a Comment