I am using Hibernate criteria and projection to get distinct values as shown below:
Criteria criteria = this.getSession().createCriteria(CmError.class); ProjectionList projList = Projections.projectionList(); projList.add(Projections.property("router")); projList.add(Projections.property("slot")); criteria.setProjection(Projections.distinct(projList)); I am using result Transformer with Projection to get list of distinct values
List<CmError> cm = criteria.setResultTransformer(Transformers.aliasToBean(CmError.class)).list(); What i am seeing is that all the field values for the list is null while the size of list is correct, meaning number of records i am expecting to return from same distinct SQL query is same as size of the CmError list but data inside list is not populating and returning null when I iterate over the list.
Not sure what i am missing.