BZ-1175417 - Engine configured with pessimistic locking throws javax.persistence.OptimisticLockException

(cherry picked from commit 652a9e4cdefed2c444f7079d152bd633b06f56f3)