这些是我的域类:
class Game {
static hasMany = [players: User]
static belongsTo = [owner: User]
}
class User {
static hasMany = [games: Game]
}
如果我尝试按原样使用它们,我会得到No owner defined between domain classes
. 所以我需要设置关系的所有者。添加static belongsTo = Game
到User
原因Domain classes cannot own each other in a many-to-many relationship
。
我能想到的唯一其他选择是添加static belongsTo = User
到Game
课程中,但我已经有了belongsTo
。
我该如何建模?