尝试使用错误的版本(2)更新步骤执行id = 1,其中当前版本为1

use*_*922 9 spring-batch spring-transactions

我使用SpringBatch 2.1.7发布核心和Infrastructure jar来读取CSV文件并将其保存到DB.

集成我的代码与Spring石英调度程序运行每分钟,批处理工作正常,读取和写入但它失败了错误"org.springframework.dao.OptimisticLockingFailureException:尝试更新步骤执行id = 1与错误的版本(2 ),当前版本是1"

由于Tx冲突.请建议我如何解决此问题.

Mat*_*ttC 6

我有同样的例外.

org.springframework.dao.OptimisticLockingFailureException: 
Attempt to update step execution id=0 with wrong version (2), where current version is 3 
Run Code Online (Sandbox Code Playgroud)

在我的情况下,它是由吞下的过程步骤失败引起的.Spring Batch激活了编写器,即使处理器发生故障.查看日志以确保您的流程步骤正在完成并返回一些内容.