Let's say I have the following domain objects:
class Family {
Person primaryContact
static hasMany = [ members: Person ]
}
class Person {
static belongsTo = [ family: Family ]
}
In other words, a Family
can have multiple members
, but only one Person
, who is also in the members
, can be the primaryContact
. Family
has a bidirectional one-to-many relationship with Person
, but it also has a unidirectional many-to-one relationship with Person
as well.
My question is, have I mapped this properly? According to the database tables, the correct columns are created, but the build-testdata plugin can't build an instance of Family
because one of the Person
instances is transient and wasn't saved.
Can someone please help?