Wednesday, 20 April 2016

How do you invoke Stored Procedures in Hibernate ?


Define the named query for the stored procedure with POJO class and properties.
Keep the property callable = "true"

Example
<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>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.