-->
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.  [ 4 posts ] 
Author Message
 Post subject: Table update returns multiple results due to update trigger
PostPosted: Fri Mar 31, 2006 3:45 pm 
Newbie

Joined: Wed Sep 28, 2005 12:24 am
Posts: 15
Here is an interesting one we ran across today. We have a single table called "Contact" and a "Contact" object to represent it.

When updating rows in this table we get the error :

org.hibernate.HibernateException: Unexpected row count: 0 expected: 1


The cause of the error is becuase we have a trigger on the contact table that writes rows to an audit table so multiple "rows returned" results come back from the database. Here is the output when run in SQL Query Analyzer:


(0 row(s) affected)


(0 row(s) affected)


(0 row(s) affected)


(1 row(s) affected)


of course because hibernate is just doing a simple update it expects to just see:

(1 row(s) affected)

hence the error..

any idea how to fix or workaround this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 11:29 pm 
Newbie

Joined: Wed Sep 28, 2005 12:24 am
Posts: 15
bump


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 10:37 am 
Newbie

Joined: Wed Sep 28, 2005 12:24 am
Posts: 15
bump. anyone?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 6:15 pm 
Newbie

Joined: Fri May 06, 2005 9:03 pm
Posts: 4
BUMP ! Anybody found a resolution for this yet?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.