I am facing org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=xxx with wrong version (0), where current version is 0 in my App. It was working and recently it started throwing this exception whenever any spring batch job is started (we use Spring batch for bulk import from excel and file export from DB, There are 6 total jobs)
The exception is thrown at the very first step and it is only occurring since yesterday as it was working fine before. The same code works in different environments.
Digging deeper to spring batch source code, I found that it is trying to update the row with step_execution_id and version in where clause but no row is updated. Then it throws this exception to notify if there is any concurrent modification. But the version which it is trying to update is 0 and current version is 0 as well. As many people have asked this question but there is a difference in updating version and current version, and in my case it's the same.
I am using spring batch 3.0.8 and Hibernate 5.4.1.
I've also tried clearing spring batch tables. Tried restarting, redeploying etc.
P.S - Pardon my English.