2
class Author{
String name
static hasMany = [books: Book]
}
class Book{
String name
Author author
static belongsTo = Author
}
然後,我有一個控制器
class MyController{
def authors{
def authors = Author.getAll()
render authors as JSON
}
的問題是,即使關聯作者書籍很懶,執行N + 1個查詢以獲取每個作者的書籍。這是怎麼回事,我該如何禁用它
什麼是JSON的全類路徑轉換的您正在使用? – 2012-03-12 15:20:02
即時通訊使用默認的JSON實現:grails.converters.JSON – geo 2012-03-12 15:45:34