Just set the appropriate foreignkeys in your database to cascading delete
and let the database handle the deletion of record. Usually you  want to
set the NHibernate cascade option to "all". Only when it is not possible to
use cascading deletes in your database then you can use "all-delete-orphan"

See this article by Ayende which is still valid:


http://ayende.com/blog/1890/nhibernate-cascades-the-different-between-all-all-delete-orphans-and-save-update


-- Ramon

On Thu, Oct 4, 2012 at 10:22 AM, Tsahi Bar <[email protected]> wrote:

> Hi,
> I have an entity which contains several sets/bags. is there any
> recommendation from NH on how to delete it? of course I can do foreach on
> each list and delete each child, but that will create many delete
> statements. is it better to create HQL for each child table, or maybe other
> approach? I've also seen on another thread to use IStatelessSession. is it
> wise here?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to