我想从表 A 中删除表 B 中不存在的所有行。为了做到这一点,我使用 session.Delete(query) 如下:
Session.Delete<A>("FROM A WHERE id NOT IN (SELECT vpg_id FROM B)");
我收到以下错误:
NHibernate.QueryException: could not resolve property: vpg_id of: A [FROM A WHERE Id NOT IN (SELECT vpgid FROM B)]
我也尝试使用 HQL 进行如下操作:
Session.CreateQuery("DELETE A WHERE id NOT IN (SELECT vpg_id FROM B)").ExecuteUpdate();
并得到这个异常:
NHibernate.QueryException: No data type for node: IdentNode vpg_id [DELETE A WHERE id NOT IN (SELECT vpg_id FROM B)]