There is a way to temporarily disable the beforeInsert event of a specific Domain Class? I need to execute the following steps:
- disable the execution of beforeInsert;
- Execute a kind of saveAs routine in an object;
- re-enable the execution of beforeInsert.
The saveAs routine executes a deep clone in a specific object and creates a new object with the same data. See this answer to understand the clone: How can I duplicate a domain object in Grails?
Reason to disable beforeInsert: Since the object is cloned the code inside beforeInsert doesn't need to be executed when the saveAs routine is executed.
Grails version: 2.5.0
Update
I forgot to mention that I want to avoid change my Domain Class to achieve this behaviour.