0

I am inserting more than 100000 records from csv to DB using Spring Batch.

<bean id="transactionManager"
        class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
<bean id="asyncTaskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor" />   
<batch:job id="loadDirect2ResponseToDB">
        <batch:step id="step1">
            <batch:tasklet>
                <batch:chunk reader="direct2CsvFileItemReader"
                    processor="direct2DBDataProcessor" writer="direct2DBItemWriter"
                    commit-interval="100" skip-limit="100">

                    <batch:skippable-exception-classes>
                        <batch:include class="java.lang.Exception" />
                    </batch:skippable-exception-classes>

                </batch:chunk>
        </batch:tasklet>
        </batch:step>

    </batch:job>

While inserting for some records it's inserting 100 by 100. Some times, for a chunk, it's inserting one by one.

Can any body help on this? Why its inserting one by one?

  • I had a glance [at the documentation](https://docs.spring.io/spring-batch/reference/html/configureStep.html) to better understand what could be going on, but there are a few unanswered questions: first, why are you skipping on *any* Exception? Second, do you log these exceptions so you can identify why the batch might fail? – Makoto Mar 14 '16 at 07:09
  • did you already read http://stackoverflow.com/a/22534131/62201 and http://stackoverflow.com/a/7026503/62201 ? – Michael Pralow Mar 14 '16 at 10:10

0 Answers0