ah...Even if you are not working with cascade your method may look like
using (ISession session = GetSession())
using (ITransaction tx = session.BeginTransaction())
{
foreach (Article article in author.Articles)
{
session.Delete(article);
}
session.Delete(author);
tx.Commit();
}
Or
using (ISession session = GetSession())
using (ITransaction tx = session.BeginTransaction())
{
session.CreateQuery("delete from Article a where a.id in
(:toDelete)").SetParameterList("toDelete", author.Articles.Select(x=>
x.Id).ToArray()).ExecuteUpdate();
session.Delete(author);
tx.Commit();
}
--
Fabio Maulo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---