-->
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: inserting into a collection with cascade
PostPosted: Thu Oct 13, 2005 6:33 pm 
I have say a letter object with a collection object containing 1,000 customer objects.

When i add new customer objects to the collection and call flush, it wants to run an sql statment for each insert to persist the customer object and then run a seperate update query for each record to setup the relationships.

This seems very inefficient. Instead of running the insert query and then straight after running the update, is their an option to just do the insert query with the updated values?


Another question. i have the customer collection in the letter setup as lazy loaded. When i delete the letter, the cascade should delete all the customer objects as well which it seems to do in a round about sort of way. When the delete is run, nhibernate first runs select statements to load all the objects before deleting them all. What is the point of that?

Can this be tuned to be more efficient as well?


Top
  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 4:28 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
First question is very frequently asked, try looking at the Hibernate website for explanations, or search this forum. The keyword here is "inverse".

The answer to the second question is that NHibernate needs to process cascades on objects being deleted so it has to load them. Also, deleting multiple objects of a joined-subclass is complicated if using just SQL (H3 implements this and they had some trouble with the bulk deletions).


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.