【发布时间】:2013-08-24 09:26:05
【问题描述】:
Spring 批处理无法跳过以下异常。任何人都可以建议我在这里错过了什么吗?
<batch:job id="runPromotion">
<batch:step id="readPromotionStep">
<batch:tasklet ref="processPromotion"></batch:tasklet>
<batch:next on="SUCCESS" to="getPromotionalPoints" />
<batch:end on="FAILED"></batch:end>
<batch:listeners>
<batch:listener ref="queryProvider"/>
</batch:listeners>
</batch:step>
<batch:step id="getPromotionalPoints">
<batch:tasklet >
<batch:chunk reader="transactionDataReader" writer="userPromotionWriter" commit-interval="100" skip-limit="100">
<batch:skippable-exception-classes >
<batch:include class="org.hibernate.exception.ConstraintViolationException"/>
<batch:include class="javax.persistence.PersistenceException"/>
</batch:skippable-exception-classes>
</batch:chunk>
</batch:tasklet>
<batch:listeners>
<batch:listener ref="queryProvider"/>
</batch:listeners>
</batch:step>
</batch:job>
下面是运行批处理时出错:
2013-08-24 14:43:16,451 - [main] 警告:org.hibernate.engine.jdbc.spi.SqlExceptionHelper:143 - SQL 错误:1062,SQLState:23000 2013-08-24 14:43:16,451 - [main] 错误:org.hibernate.engine.jdbc.spi.SqlExceptionHelper:144 - 键 'promotion_id' 的重复条目 '1' javax.persistence.PersistenceException:org.hibernate.exception.ConstraintViolationException:键“promotion_id”的重复条目“1” 在 org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1377)
【问题讨论】:
-
请发布完整的轨迹
标签: spring spring-batch