-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Oracle Stored Procedures and Hibernate 3.2
PostPosted: Thu Oct 18, 2007 10:48 am 
Newbie

Joined: Thu Oct 18, 2007 10:38 am
Posts: 7
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.