简体   繁体   中英

Hibernate Envers Revert data to a version

We are using Hibernate envers to store historical revisions of the data, there is a requirement to revert data to a certain revision. As we are using the Version column to use the optimistic locking approach, when I try to save data from the previous revision I get a StaleObjectException . Is there any way to force Hibernate to store data from previous revision?

That's an awesome question. I didn't find anything like that in the envers documentation but I'm sure it's a common issue. As a workaround you could set the attributes on the desired object revision (in a constructor for instance)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM