title: Error in Spring batch with multi-threading
body: <p>I have created a stored procedure reader that returns a ref cursor and I want to store the data from ref cursor in oracle table.I want to convert my batch processing application in multithreading where each thread works on different record received from ref cursor of stored proc.Currently I have my batch process working without multithreading where it is inserting the data properly in table.When I try to convert in multi-threading I am facing weird situations where some records are picked up by thread and some not.</p>
  
  <p>Here is my job definition and taskExecutor.Some times it also gives me error saying "Unexpected cursor position change".Any help would be really appreciated.</p>
  
  <pre><code>&lt;!-- TestUser Job definition --&gt;
  &lt;job id="TestUserJob" xmlns="http://www.springframework.org/schema/batch"
      restartable=" true " incrementer="jobParametersIncrementer"&gt;
      &lt;step id="step1" allow-start-if-complete="true"&gt;
          &lt;tasklet task-executor="taskExecutor"  throttle-limit="5"&gt;
              &lt;chunk reader="testUserItemReader" writer="testUserItemWriter" 
                  commit-interval="1" /&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
      &lt;!-- Add step2 and so on HERE --&gt;
  &lt;/job&gt;
  &lt;!-- Task executer definition --&gt;
  &lt;bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
      &lt;property name="corePoolSize" value="3" /&gt;
      &lt;property name="maxPoolSize" value="4" /&gt; &lt;!--  put in variable like ${variable-name} --&gt;
  &lt;/bean&gt; 
  &lt;bean id="testUserItemReader"
      class="org.springframework.batch.item.database.StoredProcedureItemReader"&gt;
      &lt;property name="dataSource" ref="oracle_dataSource" /&gt;
      &lt;property name="procedureName" value="get_user_func_no_arg" /&gt;
      &lt;property name="parameters"&gt;
          &lt;list&gt;
              &lt;bean class="org.springframework.jdbc.core.SqlParameter"&gt;
                  &lt;constructor-arg index="0" value="p_id_min" /&gt;
                  &lt;constructor-arg index="1"&gt;
                      &lt;util:constant static-field="java.sql.Types.INTEGER" /&gt;
                  &lt;/constructor-arg&gt;
              &lt;/bean&gt;
              &lt;bean class="org.springframework.jdbc.core.SqlOutParameter"&gt;
                  &lt;constructor-arg index="0" value="p_recordset" /&gt;
                  &lt;constructor-arg index="1"&gt;
                      &lt;util:constant static-field="oracle.jdbc.OracleTypes.CURSOR" /&gt;
                  &lt;/constructor-arg&gt;
              &lt;/bean&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="refCursorPosition" value="2" /&gt;
      &lt;property name="rowMapper"&gt;
          &lt;bean class="com.model.testUser.TestUserRowMapper" /&gt;
      &lt;/property&gt;
      &lt;property name="PreparedStatementSetter" ref="psTestUserSetter" /&gt;
  &lt;/bean&gt;
  </code></pre>