We are using Hibernate version 4.2.18 in our application and we are trying to configure Optimistic Locking and tried @Version with Timestamp column and we are facing issues with associated tables and it will take more effort for us to fix the associated entities. So, we have researched on alternate solutions and found an alternate solution with @DynamicUpdate and @OptimisticLocking with OptimisticLockType DIRTY or ALL and completed a quick POC to prove that this is working.
I could see that these annotations are available in Hibernate java doc.
@DynamicUpdate
@OptimisticLocking(type = OptimisticLockType.DIRTY)
Java doc link:
https://docs.jboss.org/hibernate/orm/4.2/javadocs/
But it is not documented as one of the ways to achieve (i.e. alternate to @Version) solution in the Hibernate developer guide documentation.
http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html_single/#d5e1239
Can anyone clarify why it is documented as a Optimistic Lock solution? Are there any known issues with using this solution? Are they deprecated in the latest version or going to get removed in any future Hibernate releases?