public IList<Customer> QueryAllCustomerHasOrdersByHSql() {
return Session.CreateQuery("from Customer c where exists( from Order a where a.Customer=c.Id)").List<Customer>();
}
public IList<Customer> QueryAllCustomerHasOrdersBySql() {
return Session.CreateSQLQuery("select c.* from Customer c where exists(select b.Customer from `Order` b where b.Customer=c.CustomerId)")
.AddEntity("c",typeof(Customer)).List<Customer>();
}
//public IList<Customer> QueryAllCustomerHasOrdersByCriteria() {
//return Session.CreateCriteria(typeof(Customer))
// .Add(Restrictions.In("Customer",))
//}
如何使用 CreateCriteria Restrictions 实现上面使用SQL的查询功能