So I load a song file containing metadata into my application, at this point a representation of the file is stored in the database as an Hibernate entity Song.
My application make various changes to the metadata, and these are audited by Envers
The changes are saved back to the file.
At a later stage user decides they dont like the changes
They start the application
They select the file they want to revert
I use AuditReader to get the earliest revison of the song entity
I then update their file with revision
So far so good, but the trouble is the Song entity still contains the changes made before reverting to the earlier revision, how can I update my song so it contains the same information as the revision.
Create a new Song object, copy all the fields using Java, merge it using an entity manager.