0

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?

Junglefish
  • 273
  • 1
  • 4
  • 16
  • possible duplicate of [Hibernate Group by Criteria Object](http://stackoverflow.com/questions/8491796/hibernate-group-by-criteria-object) – Erveron Sep 22 '15 at 09:31

1 Answers1

0

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();
Junglefish
  • 273
  • 1
  • 4
  • 16