Here's a good little tutorial on calling Stored Procedures from Hibernate:
http://mybiblebook.spaces.live.com/blog/cns!8D4E97688DE1E193!416.entryCode:
Call SQL Procedure with JDBC
connection = openSessionInViewInterceptor
.getSessionFactory().openStatelessSession().connection();
CallableStatement callableStatement = connection
.prepareCall("call proc_my_procedure(?)");
callableStatement.setObject("in_user _id", userID);
callableStatement.registerOutParameter("out_username", java.sql.Types.VARCHAR);
ResultSet resultSet = callableStatement.executeQuery();
Now, I'm a little concerned that you're new to Hibernate and already trying to call stored procedures. Remember, we want to think of our problems in an object-oriented way, and not as a bunch of queries that return data. Shift your mind, and programming with Hibernate will be much, much easier!
Quote:
The CallableStatement interface used to execute SQL stored procedures. The JDBC API provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs. This escape syntax has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number, with the first parameter being 1.
http://www.coderanch.com/t/443101/Object-Relational-Mapping/java/JPA-Stored-Procedurehttp://www.coderanch.com/forums/t/216142