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.  [ 2 posts ] 
Author Message
 Post subject: Delete performance and Delete With a Trigger
PostPosted: Wed Dec 07, 2005 9:16 pm 
Senior
Senior

Joined: Sat Sep 10, 2005 3:46 pm
Posts: 178
I put this in another post but I felt like it deserved its own thread: I noticed that when I set cascade="all" on an associated collection, Nhibernate would load all of the associated items and then delete them one by one while attempting to load each childs asscociations and then deleting them. I can easily do this with cascade delete in the databse so I wanted to let the database handle the cascading deletes for performance reasons. I had a collection an enity that had a collecion of 43 other entities and over 700 queries were sent to the database to delete all the associations. This is highly unacceptable.

With the trigger in place, I try to delete the root entity with NHibernate and I get this error:

Duplicate identifier in table for RemoteNet.Northrop.IbisWork.Domain.Model.SubStep: 2172

This is a terrible exception message because I really dont have 2 identifiers in the same table. What is happening is that after a delete operation, NHibernate is calling AbstractEntityPersister.Check which verifies that only 1 item was deleted by the query. The database is returning a recordsaffected result larger than 1 because all of the cascade deleting that occurs. how can I get around this?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 6:25 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
check out this post:

http://nhibernate.sourceforge.net/forum/viewtopic.php?t=1131&highlight=delete

cheers,
Radu


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.