I made a issue / patch for something like this in the Criteria API for Hibernate Core. See if you can take something from it?
Criteria api does not allow a groupProperty to _NOT_ be included in the selected columns
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2893
Basically it allows you to specify a groupProperty like this:
Code:
Projections.groupProperty("id.variableId",true)
Javadoc:
Quote:
@param excludeFromSelect
indicates not to include this parameter in the select clause,
and _only_ in the GROUP BY clause.