-
1. Re: Best way to create an audit history table for a specific entity with one revision per row?
adamw Jul 19, 2012 4:38 PM (in response to sunfire)Hmm, if you have the flags, don't you have all the info needed when you read the audited data?
Adam
-
2. Re: Best way to create an audit history table for a specific entity with one revision per row?
sunfire Jul 20, 2012 9:04 AM (in response to adamw)What do you mean?
Lets use an explicit example: lets assume the the Node.class has a properties "name", "size" and primary key "id". Now I want to know what properties were updated between revision 3 and 4 of the Node entity with primary key 123.
Now I am aware of multiple methods of how I could get this information BUT they would either require direct queries to the _AUD tables or fetching both revisions of the entities via Envers and then do equals() comparision for all properties that I am interested in.
But if there is any Envers build-in entity agnosic method of getting this info I'd rather use that then the ways outlined above? Something like
final List<String> modifiedPropertyNameList =
getAuditReader().getModifiedProperties(Node.class, 123, 3, 4);
where modifiedPropertyNameList would then maybe contain "name" if only the "name" property of entity 123 was modified from version 3 to 4.
Thanks
-
3. Re: Best way to create an audit history table for a specific entity with one revision per row?
adamw Aug 7, 2012 8:11 AM (in response to sunfire)Ah, I understand now.
No such built-in method in Envers (yet ).
Currently you can only get the diff from the previous version, and you'd like to flatten multiple such diffs. Possible, but not implemented yet.
Adam
-
4. Re: Best way to create an audit history table for a specific entity with one revision per row?
sunfire Aug 7, 2012 9:02 AM (in response to adamw)Ok thanks for the info. So I'll just implement this myself for now. Would be nice (and usefull I think) to get this built-in tho.
Thorsten
-
5. Re: Best way to create an audit history table for a specific entity with one revision per row?
adamw Aug 7, 2012 9:20 AM (in response to sunfire)<hint>open source project</hint>
Adam
-
6. Re: Best way to create an audit history table for a specific entity with one revision per row?
sunfire Aug 7, 2012 9:27 AM (in response to adamw)I know and I would love to contribute but there is so little spare time besides the dayjob and family. And unfortunetly contributing the solution I write for us now is not an option either due to it not being generic enough for others to use and also legal limitations. Sorry
-
7. Re: Best way to create an audit history table for a specific entity with one revision per row?
adamw Aug 7, 2012 9:33 AM (in response to sunfire)Sure, I understand, I'm often in the same situation
No worries.
Adam