How does NHibernate handle cascade="all-delete-orphan"?

Posted by Johannes Rudolph on Stack Overflow See other posts from Stack Overflow or by Johannes Rudolph
Published on 2010-05-14T17:02:13Z Indexed on 2010/05/14 17:04 UTC
Read the original article Hit count: 411

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about cascade