What is IDetachedQuery and its difference with DetachedCriteria?
What is IDetachedQuery
and its difference with DetachedCriteria
? How and when IDetached开发者_JAVA技巧Query
is used?
UPDATE:
I'm using NHibernate 2.1.2.4000
IDetachedQuery is an interface implemented by DetachedQuery and DetachedNamedQuery.
DetachedQuery is like DetachedCriteria, but for HQL queries. DetachedNamedQuery is for named queries.
As far as I know you don't use the interface directly. Example of DetachedQuery:
var deleteQuery = new DetachedQuery("DELETE FROM myObject o WHERE o.Id = IN (:idList)")
.SetParameterList("idList", list);
deleteQuery.GetExecutableQuery(session).ExecuteUpdate();
精彩评论