Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Unexpected row count: -1 expected 1 , on sql-update
PostPosted: Tue Nov 22, 2011 8:29 am 
Newbie

Joined: Tue Nov 22, 2011 8:06 am
Posts: 2
Hello,
I am using sing mapping nhibernate file with ID as sequence with generator and ,
another property "Name" ....to Oracle package stored procedure with simple one column update,
using int the mapping file: <sql-update callable="true"> call pkg.UpdateLog</sql-update>... the update will return this error
if I use the session.SaveOrUpdate:
ITransaction trans = session.BeginTransaction();
session.SaveOrUpdate(curObject);
session.Commit();


Error is : Unexpected row count: -1 expected 1, Nhibernate.StaleStateException
Whats weird is that without the <sql-update > works since I use the save directly without the stored procedure...
the stored procedure in package was tested directly with ADo.Net and it works...and as I said the NH session works with save direct call when canceling the <sql-update> SP call...

What should I fix there?

Thanks
Leeor


Top
 Profile  
 
 Post subject: Re: Unexpected row count: -1 expected 1 , on sql-update
PostPosted: Tue Nov 22, 2011 9:33 am 
Newbie

Joined: Tue Nov 22, 2011 8:06 am
Posts: 2
Ok , I have find a solution from the documentation:
The stored procedures are by default required to affect the same number of rows as NHibernate-generated SQL would. NHibernate uses IDbCommand.ExecuteNonQuery to retrieve the number of rows affected. This check can be disabled by using check="none" attribute in sql-insert element.

<sql-update check="none" /> Solved the row count exception ...

TNX anyways

Leeor


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

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.