Tsahi
Tsahi

Reputation: 455

Delete big entity efficiently with NHibernate 3

I have an entity which contains several sets/bags. is there any recommendation from NHibernate 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?

Upvotes: 0

Views: 63

Answers (1)

Rippo
Rippo

Reputation: 22424

Personally I think HQL works well in this instance.

Or if your stomach can take it use cascading deletion at the database level then delete the parent and the children precede automatically.

Upvotes: 1

Related Questions