I'm trying to use grails audit-logging
plugin. It seems to do what I need to do.
But, I'm having problem referencing id
for a domain class where id
is automatically generated.
class Person {
static auditable = true
String name
String email
def onSave = { newState ->
println "new person inserted"
// I want to get id of newly inserted person
// When I do newState[id], I get null
// newState[name] works as expected
}
}
When I try to reference id
as for other attributes, I get null
.
How can I get reference to id
so that I can get id
of newly inserted Person
entity?