grouping « Criteria « JPA Q&A





1. JPA 2.0 Criteria and grouping of Predicates    stackoverflow.com

I encounter problem with Hibernate EntityManager 3.5.3-Final when it comes to composite predicates. Example (not actual code snippet, but the idea should be clear):

CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
Predicate predicate1 = criteriaBuilder.conjunction();
Predicate predicate2 = ...

2. Hibernate Criteria grouping    forum.hibernate.org

Dear All, i have a problem in criteria API there is a bug in this criteria when i using it with grouping like Criteria criteria = session.createCriteria(VesselMove.class, "vm"); criteria.add(Restrictions.eq("vm.agentId", agentId)); criteria.setProjection(Projections.max("vm.toDate")); criteria.setProjection(Projections.property("vm.visitId")); criteria.setProjection(Projections.projectionList() .add(Projections.groupProperty("vm.visitId")) ); List result = criteria.list(); this must generate sql like select max(vm.toDate), vm.visitId from VesselMove where vm.agentId = ? group by visitId but the generated SQL is ...