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 .
Thanks
Lokee yadav
Replied on October 24, 2013
Suppose you have a procedure as
CREATE PROCEDURE 'student' (int_college_id int(50))
BEGIN
SELECT * FROM colleges WHERE college_id = int_college_id;
END
Then you can use createSQLQuery to call your procedure.
Query query = session.createSQLQuery("call student(:collegeId)")
.addEntity(Colleges.class).setParameter("collegeId", "100");