Hi,
I need to return a DTO object from my criteria query instead of an array of objects. However, as I am using a projectionList it currently returns objects. Is there anyway to keep the functionality of the query but get it to return a list of DTO's
The code for the query is
Criteria crit = getSession().createCriteria(PostingDTO.class);
crit.setFetchMode("inspection", FetchMode.JOIN);
ProjectionList proj = Projections.projectionList();
Criteria inspectionCrit = crit.createAlias("inspection", "ins", CriteriaSpecification.LEFT_JOIN);
proj.add(Projections.max("ins.instructionDate"));
proj.add(Projections.groupProperty("id"));
inspectionCrit.setProjection(proj);
crit.list();
Any help with this would be greatly appreciated.
Thanks
|