How does NHibernate handle cascade="all-delete-orphan"?
- by Johannes Rudolph
I've been digging around the NHibernate sources a little, trying to understand how NHibernate implements removing child elements from a collection. I think I've already found the answer, but I'd ideally like this to be confirmed by someone familiar with the matter.
So far I've found AbstractPersistentCollection (base class for all collection proxies) has a static helper method called GetOrphans to find orphans by comparing the current collection with a snapshot.
The existence of this method suggests NHibernate tries to find all oprhaned elements and then deletes them by key. Is this correct, in terms of the generated SQL?