tags:

views:

90

answers:

1

I'm trying to figure out why nhibernate handles one-to-many cascading (using cascade=all-delete-orphan) the way it does. I ran into the same issue as this guy:

http://stackoverflow.com/questions/706673/forcing-nhibernate-to-cascade-delete-before-inserts

As far as I can tell NHibernate always performs inserts first, then updates, then deletes. There may be a very good reason for this, but I can't for the life of me figure out what that reason is. I'm hoping that a better understanding of this will help me come up with a solution that I don't hate :)

Does anyone know or have any good theories on this behavior? In what scenario would deleting orphans first not work? Do all ORMs work this way?