I wrote an application that uses hibernate in combination with oracle to persist the data. I've been running hibernate 3.1 for a while and tried to upgrade to 3.2.
But it seems that there is a change in the way hibernate handles stored procedures and their return values.
Let's take the following simplified example:
Code:
<hibernate-mapping>
<class name="app.hibernate.MyClass" table="MYTABLE">
....
<sql-insert callable="true">
{ call MYTABLE_SAVE (?, ?, ?, ?) }
</sql-insert>
....
</class
</hibernate-mapping>
This class uses the stored Procedure MYTABLE_SAVE to persist the data (the procedure does additional stuff so it's required).
But every time I want to persit data I get:
Code:
16:11:51,206 INFO [STDOUT] Hibernate: { call MYTABLE_SAVE (?, ?, ?, ?)}
16:11:51,218 ERROR [AbstractBatcher] Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
The code that saves the data is like:
Code:
Session session = HibernateSessionFactory.currentSession();
Transaction transaction = session.beginTransaction();
MyClass my = new MyClass();
session.save(my);
transaction.commit();
HibernateSessionFactore.closeSession();
Oracle stored procedures can't return a value so how do I return the number of lines changed? Or is there a way to disable that check?
Thanks in advance,
Chris