this is a pretty strange issue.
I have a many-to-many relationship between two classes, Subscription & Scenario. Thing is I'm trying to delete the relation between them when either is deleted using "beforeDelete" in each of these classes.
ScenarioSubscription is the class representing the junction table.
This is what my beforeDelete def looks like in Scenario.
def beforeDelete = {
//Delete rows in junction table
def example = new ScenarioSubscription(scenarioId:id)
def scenSub = ScenarioSubscription.findAll(example)
scenSub*.delete(flush:true)
}
It works in the Subscription class but not in Scenario. Instead, when calling *.delete() the "beforeDelete" def is called recursively. I checked the variable when debugging and scenSub is a list of ScenarioSubscription. Crazy?!
Any idea of what is going on is very much appreciated.