Grails hasOne and hasMany same domain

后端 未结 2 1556
予麋鹿
予麋鹿 2021-01-07 15:18

I have domain like this:

class Team {
 hasOne [leader: Person]
 hasMany [member: Person]
}

class Person {
 belongsTo [team: Team]
}

But wh

2条回答
  •  爱一瞬间的悲伤
    2021-01-07 16:12

    Per the documentation:

    Use a hasOne association to store the foreign key reference in child table instead of the parent in a bidirectional one-to-one.

    You're child table here is Person and your parent is Team. Grails is working as expected.

提交回复
热议问题