Hi All!

Is there any reasons why currently orphans deletion is executed as a last 
step in cascade update for "all-delete-orphan" cascade option? (see method 
CascadeCollectionElements 
,NHibernate-3.4.0.GA-src\src\NHibernate\Engine\Cascade.cs)

It is my understanding that this causes issues when you try to add and 
delete entities with the same value for unique constraint property (or with 
the same assigned ID):
parent.ChildCollection.RemoveAll(ch => ch.Name == "ExistingUniqueName");
parent.ChildCollection.Add(new Child{Name ="ExistingUniqueName");

Currently flushing the code above will result in a unique constraint 
violation as a new child insert will be executed first. So why don't delete 
items at first and then insert?

P.S. Similair question discussed in stackoverflow with no good 
solution: 
http://stackoverflow.com/questions/706673/forcing-nhibernate-to-cascade-delete-before-inserts

Thank you!
Roman

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to