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<Object> 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 select vm.visitId from VesselMove where vm.agentId = ? group by visitId
where tha max(vm.toDate) is disappear?
Thanks.
_________________ ahmed ali
Developer at ISFP company
|