开发者

How to get stores with more than 2 products which price is greater than 2.0$?

开发者 https://www.devze.com 2022-12-17 10:35 出处:网络
Each Store has many Products. Store 开发者_如何学Go--> (N) Products How to create an NHibernate criteria to get stores with more than 2 products which price is greater than 2.0$ ?

Each Store has many Products.

Store 开发者_如何学Go--> (N) Products

How to create an NHibernate criteria to get stores with more than 2 products which price is greater than 2.0$ ?

I know how to get Stores based on a criteria on Products and I also know how to get the count of Products which Price is greater than 2, but I can't find a way to put a criteria on the count.


You're looking for a DetachedCriteria - it lets you run a subquery - in your case, the number of products whose price is greater then $2, then us it as a criteria.

https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/querycriteria.html#querycriteria-detachedqueries

0

精彩评论

暂无评论...
验证码 换一张
取 消