Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.5
Name and version of the database you are using: SQL Server 7.0
Hi all,
I need to translate the following query into Criteria API :
SELECT COUNT(OrderId) FROM OrderDetails GROUP BY OrderId HAVING COUNT(OrderId) > 1.
So far I come up with the following routine :
Code:
Criteria criteria = session.createCriteria(OrderDetail.class);
ProjectionList projectionList = Projections.projectionList();
projectionList.add(Projections.count("orderId"));
projectionList.add(Projections.groupProperty("orderId"));
criteria.setProjection(projectionList);
But I have no idea how to specify the HAVING clause.
Any help would be greatly appreciated.
Regards,
Setya