作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当 spring batch 尝试提交记录时,我收到 Commit failed while step execution data was already updated 错误。任何帮助将不胜感激。我正在使用 HIbernate JPA。
它适用于较少数量的记录。当记录计数很高时抛出错误。
堆栈跟踪:
2016-01-20 08:49:45 INFO TaskletStep:359 - Commit failed while step execution data was already updated. Reverting to old version.
2016-01-20 08:49:45 ERROR TaskletStep:370 - Rolling back with transaction in unknown state
2016-01-20 08:49:45 ERROR AbstractStep:225 - Encountered an error executing step uploadFiles in job fileUploadJob
org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:524)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
最佳答案
我有同样的错误“提交失败,而步骤执行数据已经更新。恢复到旧版本”,我通过在提交记录的方法上方使用“@Transactional(propagation = Propagation.REQUIRES_NEW)”注释解决了这个问题。
关于java - 提交失败,而步骤执行数据已更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34902380/
我是一名优秀的程序员,十分优秀!