-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
embedded properties #111
Comments
Not yet supported. I'm not sure if the oldValue / newValue maps hold the individual attributes. Need to setup an example project and test, as the embedded domain components are rarely used (I never did and always use associations to avoid data duplication). Have you had a chance to check the oldValue / newValue maps for composition object changes? |
Hi, I am also having similar problem. I have a legacy class that I need to audit. This legacy class also has an embedded object in it. class Employee {
} At DB side, there is a single Employee table which has all columns. Works fine when any of the Employee properties such as name, email, salary is udpated
I printed the oldMap and newMap in onChange() method, and the newMap does have the updated Address properties. Is there a way I can change the newMap values so that it gets reflected in DB as well? For testing, I tried updating the newMap in onChange() method for any of the simpler property e.g: Employee.name (when name property is getting changed), but that didn't work. def onChange = {
Console Output: Employee was changed ...
I was expecting that new_value will be equal to "UPDATED NAME VALUE***" Basically, I want to get the correct values getting reflected in database for any domain object update. |
please try version 2.0.2 |
Thanks a lot Robert for looking into this. However, I am still facing that issue for embedded objects. In my BuildConfig.groovy, I updated below line: from to I still see below getting logged in database:
Am I doing something wrong? Do I need to do something else to upgrade to newer version which contains the fix. |
Can you please setup a small sample project on GH, so we can analyze? Please use the same Grails version. |
any news on this @msg4ashis ? |
Hi Robert, |
Is there a way to log changes to fields of embedded objects individually? The usual example is probably an Address class with fields such as "street", "city", "zip" etc which is embedded into a User class and something like a Building class. As far as I understand, old value and new value are logging address.toString() for each change to one of the fields inside address.
The text was updated successfully, but these errors were encountered: