Stored Procedure

Asked on October 24, 2013

Hi All ,


  can call the stored procedures by using hibernate?, if yes please let me know how can we call the stored procedures in the hibernate .


Lokee yadav


Replied on October 24, 2013
Suppose you have a procedure as

CREATE PROCEDURE  'student'  (int_college_id int(50))
   SELECT * FROM colleges WHERE college_id = int_college_id;

Then you can use createSQLQuery to call your procedure.

Query query = session.createSQLQuery("call student(:collegeId)")
.addEntity(Colleges.class).setParameter("collegeId", "100");

Write Answer

©2024 | Privacy Policy | Contact Us