views:

33

answers:

2

The query below makes use of ExecuteUpdate. I want said method to respect session filters. Is this possible?

//This line seems to make no effect.
_session.EnableFilter(FilterName).SetParameter(FilterParam, Value);


_session.CreateQuery(String.Format("DELETE  FROM {0} WHERE Id IN (:idList)", object.Name))
                        .SetParameterList("idList", arrayOfIds)
                        .ExecuteUpdate();

Thanks,

+2  A: 

No, it's not possible.

HQL batch update statements are relatively low-level in the NHibernate stack and they will not honor filters.

Diego Mijelshon
+1  A: 

No and the reason is that filters are not domain 'transformers'. They are there just to modify what you want to select. To do what you want you can specify the WHERE class attribute in your mapping although this does not (officially) support parameters

Jaguar