Announcement Announcement Module
Collapse
No announcement yet.
how don't stop batch after exception Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how don't stop batch after exception

    Hi, i'm new in spring batch and i need your help!
    i have a batch that:
    1) a line from a csv
    2) made some processor
    3)write in multiple table (i'm using ibatis for this)

    i've commit=1 than for each line i made a commit.
    the problem is: if i have a SQLException the batch, made the rollback (and this is ok) but stop to execute!

  • #2
    code:
    <batch:job id="popolamentoConoVisibilitaJob">
    <batch:step id="StepReadCono">
    <batch:tasklet>
    <batch:chunk reader="fileItemReader" processor="compositeItemProcessor" writer="compositeItemWriter" commit-interval="1">
    </batch:chunk>
    </batch:tasklet>
    </batch:step>
    </batch:job>

    <bean id="compositeItemProcessor" class="org.springframework.batch.item.support.Comp ositeItemProcessor">
    <property name="itemProcessors">
    .......
    </property>
    </bean>

    <bean id="compositeItemWriter" class="org.springframework.batch.item.support.Comp ositeItemWriter">
    <property name="delegates">
    <list>
    .....
    </list>
    </property>
    </bean>

    <bean id="fileItemReader" class="org.springframework.batch.item.file.FlatFil eItemReader" scope="step">
    <property name="resource" value="file:#{jobParameters['param.file.input']}" />
    <property name="lineMapper">
    <bean class="org.springframework.batch.item.file.mapping .DefaultLineMapper">
    .......
    </bean>
    </property>
    </bean>

    Comment


    • #3
      If I understand correctly, you want a rollback on a SQLException, but you want the execution to keep on running, not failing. You can skip exceptions with Spring Batch: http://static.springsource.org/sprin...onfiguringSkip

      Comment

      Working...
      X