NHibernate Pitfalls: HQL Delete Does Not Cascade
This is part of a series of posts about NHibernate Pitfalls. See the entire collection here.
When you issue an HQL delete statement over an entity, you may be surprised to find out that it will not cascade to any configured associations it may have:
1: session.CreateQuery("delete from Order o where o.Id = :id").SetParameter("id", 10).ExecuteUpdate();
If you really want to cascade associations, you will have to load the entity explicitly and then call ISession.Delete() upon it.