Criteria query, group by

I have a simple criteria query:

prc.arrDomainACST = c
.createAlias(‘ACCR_DOMA_KY’, ‘d’, c.LEFT_JOIN)
.withProjections(property = ‘ACMA_KY,d.SHORT_DESCRIPTION_LB,ACCR_DOMA_KY.DOMA_KY’)
.order(‘d.SHORT_DESCRIPTION_LB’,‘asc’,true)
.list();

How do I add “group by ACCR_DOMA_KY.DOMA_KY” to it?

I have tried this:

.withProjections(property = ‘ACMA_KY,d.SHORT_DESCRIPTION_LB,ACCR_DOMA_KY.DOMA_KY’, groupproperty=“ACCR_DOMA_KY.DOMA_KY”)

but I get a “not a GROUP BY expression” error. And using min() or max() functions on the other two columns gets me a “could not resolve property” error.

What am I missing here?

Ah! I have the answer, It’s this:

prc.arrDomainACST = c
.createAlias(‘ACCR_DOMA_KY’, ‘d’, c.LEFT_JOIN)
.withProjections(property = ‘ACCR_DOMA_KY.DOMA_KY’, max=“ACMA_KY”, max=“d.SHORT_DESCRIPTION_LB”, groupproperty=“ACCR_DOMA_KY.DOMA_KY”)
.order(‘d.SHORT_DESCRIPTION_LB’,‘asc’,true)
.list();