Call Stored Procedure In Hibernate:
Here is the simple answer of question 'How to call stored procedure in Hibernate?'.A stored procedure is a declarative SQL statements stored inside the database. A stored procedure can be invoked by triggers, using other stored procedures or applications such as Java, C#, PHP, etc.
Hibernate provides the easy way to call the stored procedures. There are different ways to create query to call stored procedures in hibernate. As simple JDBC query we can also pass the parameters in stored procedures.
Suppose user has a following stored procedure in the database :
CREATE PROCEDURE 'getCustomers'(status varchar(20))
SELECT * FROM customerInfo WHERE status = status;
In database you can call stored procedure using triggers and direct put following statement :
In Hibernate create a DAO class and use following code: