モデル:
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
}
問題は、Author-Books の関連付けが遅延している場合でも、各 Author の本を熱心に取得するために N+1 クエリが実行されることです。何が起こり、どうすれば無効にできますか