Expected Behavior
I have a detached object A with optimistic locking where the object has changed in another HibernateSession.
I call merge on the detached instance to get a new persistent instance B that has the dirty fields from the detached object A copied over.
If I call save on that, I would expect when the Hibernate Session gets flushed, B will cause a successful save.
Actual Behaviour
Object B in the above does not have the value of the version property set to what is in the DB for the object, it has retained the value that object A had.
When the changes in Object B is flushed - it fails because the version column value is included in the update where clause with a value that does not represent what is on the DB.
Steps To Reproduce
ExampleApp.zip provided
Run the supplied integration test
exampleApp.zip
Environment Information
WSL2
Java 17
Example Application
No response
Version
6.2.3
7.0.0-M5