Get the name of the verified entities, the old value and the new value of a given version
I am using envers to audit the User class and save all changed data to DB with rev number. Now I need to restore all edited entity names, old value and new value by passing the version number as a parameter.
I've read the envers doc but haven't found any solution for it.
Can anyone suggest? thank
source to share
The version number uniquely identifies the version of an object, so when you get an object in a specific revision, you get it with the values ββit had then.
To get the old and new values of the fields, if you know that the essence has been changed in version N
, the easiest way - to get the object versions N-1
and N
and compare the fields that you are interested.
This can be done in one request using a request forRevisonsOfEntity
(see AuditReader
and AuditQueryCreator
javadocs )
source to share