7.5.3 Default Sort Order - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 3.1.4
7.5.3 Default Sort Order
You can sort objects using query arguments such as those found in the list method:def airports = Airport.list(sort:'name')
class Airport {
    …
    static mapping = {
        sort "name"
    }
}Airport instances will by default be sorted by the airport name. If you also want to change the sort  order , use this syntax:class Airport {
    …
    static mapping = {
        sort name: "desc"
    }
}class Airport {
    …
    static hasMany = [flights: Flight]    static mapping = {
        flights sort: 'number', order: 'desc'
    }
}flights collection will always be sorted in descending order of flight number.
These mappings will not work for default unidirectional one-to-many or many-to-many relationships because they involve a join table. See this issue for more details. Consider using a SortedSet or queries with sort parameters to fetch the data you need. 
                
                
                    
                
                    
                
                
            