Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How to call stored procedure in mysql through hibernate?
If your stored procedure is returning a value you can directly use <sql-query>, otherwise you need to use jdbc connection to call the native sql procedure.

Example:
Session session = getHibernateTemplate().getSessionFactory().openSession();
/*if you are not using session factory, you can use ur own method to get session.*/
Connection conn = session.connection();
String sqlQuery = "call VersionUpdateProcedure()";
CallableStatement cs = conn.prepareCall(sqlQuery);
cs.execute();
conn.close();
session.close();