Apr 8th, 2010, 08:42 AM
Doubt in Step Execution
I am new to Spring Batch Framework. I am trying couple of programs.
My requirement is:
1. Move data from table A to table B after performing some operations on table A's data.
2. Say there are 1 million records in Table A. I should read 10000 records at a time, perform some operations on this and insert into table B. This should repeat for 1 million records.
My question is:
How the same step is executed till 1 million records is processed.
My code is:
<job id="sampleJob" job-repository="jobRepository">
<chunk ref="itemReader" writer="itemWriter" commit-interval="10000"/>
Apr 8th, 2010, 09:14 AM
your item reader will read items from table A. Since you requested a chunk of 1000 elements, the framework will commit the transaction every 1000 elements.
When your item reader has read the last element, the next call to it will return null. This indicates that there are no more items to process. Spring Batch offers out-of-the-box database readers (and writers).
This might help as well: