I have a grails domain hasMany and belongsTo relationship as the below :
I am wanting to sort based on 'Submission' 'lastUpdated' 'desc'
class User {
String username
String password
static hasMany = [ submissions: Submission ]
static mapping = {
sort submissions: 'desc' // This doesn't do anything?
}
}
class Submission {
String reference
Date dateCreated
Date lastUpdated
static belongsTo = User
}
So everytime I collect a User's submissions, I would like it default sorted as lastUpdated desc. The equivalent mysql statement would be the following
select (fields) from submission order by last_updated desc;
Am i missing something?
Thanks greatly!