I expect it to work correctly. Error on overflow and version ++! =. This will lead to the risk of overwriting updates if you use a short code and have 65536 transactions with updates to this object until the first is completed.
Edit: when you use @Version, then update requests will not look like this:
update person set surname = ? where id = ?
but like this:
update person set surname = ?, version_field = ? where id = ? and version_field = ?
JDBC will now return the number of updates after completion. If the update was not performed, the JPA implementation assumes that no data with the specified identifier and version was found β Exception.
source share