-->
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: Trigger error
PostPosted: Wed Aug 03, 2005 3:34 am 
Beginner
Beginner

Joined: Fri May 20, 2005 5:06 am
Posts: 28
I use NHibernate V 0.9 and I have a table with a trigger and I get the following error message when saving an object with NHibernate to that table:
Code:
NHibernate.HibernateException: SQL insert, update or delete failed (expected affected row count: 1, actual affected row count: 3). Possible causes: the row was modified or deleted by another user, or a trigger is reporting misleading row count.

I understand the errormessage, but I don't think that this error should appear, because the trigger should do its job. So does this mean I can't save an object to this table, or is there a possibility to tell NHibernate to ignore the rowcount?

Thanks, Rainer.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 03, 2005 6:42 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
There should be a way to tell the trigger to report the right row count (1 row, if it worked). I'm not sure if just using "rowcount > 1" instead of "rowcount == 1" comparison is safe enough.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 1:41 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
You need to put the following command on the first line of your triggers.

Code:
SET NOCOUNT ON


You can then optionally (recommended) add to the end of each trigger

Code:
SET NOCOUNT OFF


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 4:10 am 
Beginner
Beginner

Joined: Fri May 20, 2005 5:06 am
Posts: 28
Thanks alot! That was it :D


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.