gpt4 book ai didi

java - 提交失败,而步骤执行数据已更新

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:55:48 25 4
gpt4 key购买 nike

当 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com