1

我有域名

训练

class Training {

       static belongsTo = [venue: Venue]
 }

场地

  class Venue {
        static belongsTo = [city: City]
  }

城市

 class City {
  String name
}

现在我想根据City name. 有没有办法在 Grails (Gorm) 方式中做到这一点?

4

3 回答 3

1

你有没有尝试过

def results = Training.withCriteria {
    order('venue.city.name', 'asc')
}
于 2013-01-02T07:48:24.650 回答
1
Training.list().sort{it.venue.city.name}
于 2013-01-02T18:02:19.940 回答
1
def results = Training.list(sort:"venue.city.name", order:"asc")
于 2013-01-03T20:14:16.460 回答