【发布时间】:2009-11-09 16:44:43
【问题描述】:
我有以下 grails 域(示例):
// a member of the library
class LibraryUser {
string name
}
// a book
class Book {
string title
string author
}
// association which user currently has which book checked out
class Checkout {
LibraryUser user
Book book
}
如何检索给定用户当前已签出的按字母顺序排序的图书列表? (使用条件查询)
一个类似的问题是,如果我没有明确地对 Checkout 表进行编码,而是使用 has-many:
// a member of the library
class LibraryUser {
string name
static hasMany = [ books : Book ]
}
// a book
class Book {
string title
string author
}
如何在此处使用条件查询来检索给定用户的所有当前已签出书籍的按字母顺序(!)排序的列表?
【问题讨论】:
标签: grails