我有一個具有一對多的關係如下面動態腳手架顯示該域的類: 域: package mienapp
class Announcements {
String user
String title
String comments
Date dateCreated
static hasMany = [tag: Tags]
static ma
我 class User {
String name
hasMany = [books: Book]
}
class Book (
String name
belongsTo = [user: User]
}
現在,我可以訪問用戶實例的所有書籍: def user = User.find("someId")
println user.book