Need help with Stored Procedures with Hibernate. have a insert stored procedure that I would like to call from hibernate. I am getting all sorts of problems but am not able to get it to work. the details of the my implementation is given below. Can someone pl guide me with this issue.
[b]Hibernate version: 3.0.5
[b]Mapping documents:
STORED PROCEDURE::
Stored Procedue has 5 input paramters, it inserts these
paramenters into a database table (book)
Here is the part of the Stored Procedure. I dont need to get any output
back.
PROCEDURE GET_BOOK_KEY
(
c_code IN country.code%TYPE,
s_id IN book.system%TYPE,
v_id IN book.vendor%TYPE,
b_id IN book.book%TYPE,
g_id IN book.generation%TYPE
)
XML Document:
<sql-query name="get_book_Key_SP" callable="true">
{ call get_book_key(?,?,?,?,?)}
</sql-query>
Code between sessionFactory.openSession() and session.close():
3. Java code
// get the session from the factory
session = HibernateSessionFactory.currentSession();
//start a transaction before doing something from the database
tx = session.beginTransaction();
Query listQuery = session.getNamedQuery("get_book_Key_SP");
listQuery.setString(0,country);
listQuery.setInteger(1,system);
listQuery.setInteger(2,vendor);
listQuery.setInteger(3,book);
listQuery.setInteger(4,generation);
// r = listQuery.executeUpdate();
This line gives an execption that cant run executeUpdate on SQL
Name and version of the database you are using: Oracle 9i
I tried lot of variations and I wasnt successful..
My hibernate version is 3.0.5 and Oracle 9i.
can some one pl tell me how to execute his stored procedure with hibernate.
Have a deadline in a day any help would be greatly appreciated..
|