Using Projections in JPA 2
问题 I need to convert a Hibernate criteria query like the following curList = session.createCriteria(Islem.class) .createAlias("workingDay", "d") .setProjection(Projections.sum("amount")) .add(Restrictions.eq("currency", CURRENCY)) .add(Restrictions.eq("product", product)) .add(Restrictions.ne("status", INACTIVE)) .add(Restrictions.eq("d.status", ACTIVE)) .getResultList(); However in JPA (2) I have no idea how to implement the projection - in this case - the sum. It's odd that Hibernate and JPA