views:

159

answers:

1

hi, I have an application with two domain classes as follows:

DomainA : PK, name

DomainB : PK, FK (points to DomainA.PK), name.

And when I try to list elements that belongs to DomainA using the DomainB.name as order factor, as follows:

def listings DomainA.createCriteria().list(params) {
  PK{
     order('name','asc')
  }
}

This works with mysql but not with H2 giving me the next error:

Column DomainB.name must be in the GROUP BY list; SQL statement:

So Itried the next solution without lucky:

def listings DomainA.createCriteria().list(params) {
  projections{
     groupProperty('name')
  }
  PK{
     order('name','asc')
  }
}

Any Ideas or solutions to this? Thanks in advance.

A: 

You can always fall back to an HQL query instead of using criteria.

Jared