gpc / grails-audit-logging-plugin

The Grails Audit Logging Plugin
Apache License 2.0
50 stars 60 forks source link

Tracking audits for Embedded objects #232

Open wrvenkatesh opened 4 months ago

wrvenkatesh commented 4 months ago

Hi

I have a domain object with another domain object within it as one of the attributes. When using the plugin and persisting to the domain object along with embedded object, i am not seeing audits for the embedded object

For instance

class Employee { String name; EmployeeProfile profile; }

class EmployeeProfile { String nationality; }

Below is just an example and not actual code EmployeeProfile profile = new EmployeeProfile(); profile.nationality = "India";

Employee employee = new Employee(); employee.name = "John Doe"; employee.profile = profile;

employee.save(flush: true);

I have created 2 new domain objects each for the audit separately.

Expected Behavior:

When i save employee, i am expecting both the audit tables to be tracked separately for the attributes that has changed

Actual Behavior:

Employee audit table gets tracked for the attributes including profile where profile's id value is tracked. EmployeeProfile audit table is not touched at all. No attributes of this domain is being tracked

How do I make sure both domain attributes are being tracked? What change should I make to incorporate that? Any help is much appreciated.

Environment Information

Operating System: Windows GORM Version: Grails Version (if using Grails): 4.0.10 JDK Version: Java 8

Thanks Venkatesh

wrvenkatesh commented 4 months ago

@robertoschwald - any help here on my question?