Steve
Steve

Reputation: 1467

Grails GORM how to sort on hasMany where type is String

I am wondering how to set a default sort order where the hasMany is of type String, by example:

static hasMany = [possibleValues: String]

 static mapping = {
    possibleValues sort: '???', order: 'asc'
}

Normally you can set this on a field of the association, but here the association is not a Domain class.

Thanks...

Upvotes: 1

Views: 750

Answers (1)

Nathan Hughes
Nathan Hughes

Reputation: 96385

This is a unidirectional association, so default sort order isn't supported. Apparently the sorting relies on having a join table handy.

Upvotes: 1

Related Questions