I found this Hibernate Criteria/Projection tutorial clear, concise and informative.
The author, A.P.Rajshekhar, says,
SELECT COUNT(ID) FROM ORDER HAVING PRICETOTAL>2000 GROUP BY ID
Can be rewritten in Criteria query as follows:
List orders = session.createCriteria(Order.class)
.setProjection( Projections.projectionList()
.add( Projections.count(“id”) )
.add( Projections.groupProperty(“id”) )
)
.list();
However, where does the HAVING PRICETOTAL>2000 show up in the Hibernate code? Is there a missing criterion (where clause in SQL) for this comparison?