When to use @Version and @Audited in Hibernate?
hibernate
Solution
`@Version` is used to implement Optimistic locking with Hibernate, which means that no two transactions override the data at the same time with a conflict. If the data is read by two threads at the same time, and both try to update the same row with different values, Hibernate uses the `@Version` field to check if the row is already updated. Before committing, each transaction verifies that no other transaction has modified its data. If modified, the last transaction encounters a "Working with stale data" error.
`@Audited` is used to perform auditing functionality on entities part of Hibernate Envers
Problem
Could someone help me with the use case when to use `@Version` and `@Audited` in Hibernate?