-
1. Re: Finding which attributes changed
nseb Jan 6, 2011 7:08 AM (in response to benbertola1)+1 , I have the same urgent need
-
2. Re: Finding which attributes changed
billgloff6 Jan 6, 2011 5:36 PM (in response to nseb)I also have the same need and since I didn't see it anywhere in Envers I created my own solution in roughly 100 LOC. For example, I need to see the diffs in all of the user revisions, so I run my auditReader query as such
AuditQuery query = getAuditReader().createQuery()
.forRevisionsOfEntity(User.class, false, true).add(AuditEntity.id().eq(id));I then loop through all User objects and call BeanUtils.describe() on it which returns to me a Map of all readable properties. I then loop once more and compare the current Map to the previous revision Map and only record what is different between them and return a list to the client with all the recorded changes. I know it sounds like more work than what you probably wanted to do, but using BeanUtils.describe really cut down on the code to get all of those properties into a nice structure to work with.
If anyone else knows a better way, please let me know!
-
3. Finding which attributes changed
adamw Jan 11, 2011 2:41 PM (in response to billgloff6)Hello,
I think that's the best way to do it - there's nothing built into Envers which would help with that.
But contributions are always welcome!
Adam