I've been using hibernate envers to for auditing purpose in my spring-boot app but there's a requirement where I need to give an option to revert to the previous record from the audit table.
In the present case, I'm fetching the data from the audit table and updating the base table. So is there any better way to do this?
That is the recommended approach.
Envers does not provide a feature where you can specify that it attempt to restore from an audited snapshot simply because your entity mapping may only audit a subset of fields so its best to leave that open for interpretation by the application.
So yes, you'd fetch the audit snapshot of interest, overlay that data atop of your current entity data from the main table and then merge those changes to the persistence context.