Grails onLoad() audit
-
27-10-2019 - |
Question
I see that grails-audit plugins provide way of logging onCreate() onUpdate() events, but I also need to track onLoad() events.
Is there any standard way to do it using any plugin? Or I need to implement it myself?
Solution
You can add onLoad closure to the domain class. It will be executed when the object is first loaded from the database.
class Foo {
int bar;
def onLoad = {
// onLoad fired
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow