Question: Dose nHibernate play well with database level cascading deletions? What I mean is that if I have a constraint set at the RDBMS level to cascade delete all orphans, will nHibernate invoke any custom delete logic at the application level if I were to delete an entity though nHibernate? Or should I remove the cascading deletions from the RDBMS level and just use the cascading delete feature of nHibernate itself by defining that behavior though its configuration?

Thanks

Answer: 
It can work with database level cascades. You can declare them in the mapping, so the hbm2ddl tool will generate the `on delete cascade`. The option is in the collection's `key` property.

```
<bag ...>
    <key column="someId" on-delete="cascade" />
...
</bag>

```
It depends what you mean by "play well". You can use cascading deletes with NHibernate but you need to be careful to refresh objects that may be affected by cascading deletes. As with triggers, NHibernate will not know that the database representation of an object has changed due to a database operation. I would avoid using them for this reason in most cases.