-->
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: SQL insert update failed
PostPosted: Tue Feb 21, 2006 3:17 am 
Beginner
Beginner

Joined: Mon Oct 17, 2005 1:58 am
Posts: 27
Hi ,
Can anyone provide me more information on when the following Nhibernate Exception occurs.


SQL insert, update or delete failed (expected affected row count: 1, actual affected row count: 0). Possible causes: the row was modified or deleted by another user, or a trigger is reporting misleading row count.


Top
 Profile  
 
 Post subject: Re: SQL insert update failed
PostPosted: Tue Feb 21, 2006 4:30 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
sandipandeb wrote:
Hi ,
Can anyone provide me more information on when the following Nhibernate Exception occurs.


SQL insert, update or delete failed (expected affected row count: 1, actual affected row count: 0). Possible causes: the row was modified or deleted by another user, or a trigger is reporting misleading row count.


One example: if update query looks like

UPDATE YourTable
SET [..]
WHERE Id = 1

But there is no row with Id = 1 in database. According to posts in the forum, it may happen when NHibernate is unable to correctly determine whether an object must be inserted or updated in database. (NHIbernate thinks that he must update an object but in realuity the object needs to be inserted).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 4:40 am 
Beginner
Beginner

Joined: Mon Oct 17, 2005 1:58 am
Posts: 27
Thanks,

In my case I have three tables .Two of these tables have a many to many relationship between them which is maintained by a link table(fourthttable).
The third table has foreign key to one of the two tables mentiones earlier.

Now when i insert data into theses three tables one after another using nhibernate.the records are properly entered..But when i want to delete all these tables i get the "INSERT UPDATE FAILED' exception.

Further i would like to add that i do not have any triggers in the database.

What could be the problem?Any suggestions ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 5:14 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
sandipandeb wrote:
Thanks,

In my case I have three tables .Two of these tables have a many to many relationship between them which is maintained by a link table(fourthttable).
The third table has foreign key to one of the two tables mentiones earlier.

Now when i insert data into theses three tables one after another using nhibernate.the records are properly entered..But when i want to delete all these tables i get the "INSERT UPDATE FAILED' exception.

Further i would like to add that i do not have any triggers in the database.

What could be the problem?Any suggestions ?

Might it be that NHibernate tries to delete from relation table several times? It would be propably good if You can create an test case and post it to Jira

Gert


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.