NHibernate and batch update

Today in a project I need to delete a lot of object from a table, the objects are instances of ActionLog and I want to delete all logs related to action when an action is deleted.

The problem is that nhibernate does not still support batch query as hibernate for java does (as explained in hibnernate in action). So I was forced to do a direct sql query.

1
2
3
4
uow.Session.CreateSQLQuery("Delete from SchedulerActionLog where aclg_ActionId = :actId")
  .AddScalar("count", NHibernateUtil.Int32)
  .SetInt32("actId", actionDto.Id)
  .UniqueResult();

This does not like me very much since with sqlquery you are actually bypassing the mapping and dialect. Today I’ve no time, but if someone knows a better solution please let me know :D

Alk.