I want to write a criteria query using "group by" and want to return all the columns.
Plane sql is like this:
select * from Tab group by client_name order by creation_time;
I understand that it will have count(distinct client_name)
number of rows.
My current query which doesn't seem to give proper result is as follows:
Criteria criteria = getSession(requestType).createCriteria(Tab.class);
criteria.setProjection(Projections.projectionList().add(Projections.groupProperty("client_name")));
criteria.addOrder(Order.asc("creationTime"));
This query returns "client_name"
only. I don't want to manually put all column names. There must be some way, what could be done?