Reputation: 2238
Here's a simplified version of the classes I'm using:
class Foo {
Bar importantBar
static hasMany = [ bars: Bar ]
}
class Bar {
static belongsTo = [ foo: Foo ]
}
Now, the Bar
that's in the Foo
class as importantBar
can also exist in the bars
set. What I want to have happen is when I delete a Bar
, and it happens to be an importantBar
, I want it to be deleted from both places in the Foo
object. Declaring static hasOne = [ importantBar: Bar ]
has not worked either, as when I add a new Bar
to the bars
set, it is automatically being set as the importantBar
property of the Foo
class. I don't want that to happen.
Is there any sort of mapping I don't know about that can do what I'm asking?
Upvotes: 0
Views: 62