title: Spring Batch Paging Issue
body: <p>I am working on Spring Batch and I am using paging for fetching data from DB. for the first time Its firing Query as expected but for second page its adding one more unexpected parameter. I don't understand why. </p>
  
  <p>My Query in XML file is </p>
  
  <pre><code>&lt;bean id="summaryAppReader" scope="step" autowire-candidate="false"
      class="org.springframework.batch.item.database.JdbcPagingItemReader"&gt;
      &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;property name="rowMapper"&gt;
          &lt;bean class="com.majesco.nyl.batch.mapper.SummaryApplicationRowMapper" /&gt;
      &lt;/property&gt;
      &lt;property name="queryProvider"&gt;
          &lt;bean
              class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
              &lt;property name="fromClause" value="VIEW_SUMMARY_APPLICATION" /&gt;
              &lt;property name="selectClause"
                  value="application_id, upper(application_status)  as application_status,relationship_code, create_date,submission_date,transmission_date,TRANSMISSION_STATUS,tpa_notes,site_details_id,transaction_num,PROCESS_STATUS,process_date,application_status_date,first_name,middle_name,last_name,suffix,prefix,APPROVED_REJECTED_DATE,action_by,ass_acronym,user_name,applicant_name,site_name,ASSOCIATION_ID, (TO_DATE('#{jobParameters['runDate']}', 'yyyy-mm-dd') - trunc(create_date)) as elapsedDays" /&gt;
              &lt;property name="sortKeys"&gt;
                  &lt;map&gt;
                      &lt;entry key="transaction_num" value="ASCENDING" /&gt;
                  &lt;/map&gt;
              &lt;/property&gt;
              &lt;property name="whereClause"
                  value="(upper(application_status)='PENDING' OR (upper(application_status) IN ('APPROVED','DECLINED') AND trunc(application_status_date) = TO_DATE('#{jobParameters['runDate']}', 'yyyy-mm-dd'))) and TRANSACTION_NUM &amp;gt;= :minId and TRANSACTION_NUM &amp;lt;= :maxId" /&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="parameterValues"&gt;
          &lt;map&gt;
              &lt;entry key="minId" value="#{stepExecutionContext[minValue]}" /&gt;
              &lt;entry key="maxId" value="#{stepExecutionContext[maxValue]}" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>for fetching data for first page its firing query something like this and its expected</p>
  
  <pre><code>Reading page 0
  SQL used for reading first page: [SELECT * FROM (SELECT application_id, upper(application_status)  as application_status,relationship_code, create_date,submission_date,transmission_date,TRANSMISSION_STATUS,tpa_notes,site_details_id,transaction_num,PROCESS_STATUS,process_date,application_status_date,first_name,middle_name,last_name,suffix,prefix,APPROVED_REJECTED_DATE,action_by,ass_acronym,user_name,applicant_name,site_name,ASSOCIATION_ID, (TO_DATE('2016-06-29', 'yyyy-mm-dd') - trunc(create_date)) as elapsedDays FROM VIEW_SUMMARY_APPLICATION WHERE (upper(application_status)='PENDING' OR (upper(application_status) IN ('APPROVED','DECLINED') AND trunc(application_status_date) = TO_DATE('2016-06-29', 'yyyy-mm-dd'))) and TRANSACTION_NUM &gt;= :minId and TRANSACTION_NUM &lt;= :maxId ORDER BY transaction_num ASC) WHERE ROWNUM &lt;= 10]
  Using parameterMap:{minId=100000002630, maxId=100000002663}
  </code></pre>
  
  <p>But for the second page its adding one more parameter in Query _TRANSACTION_NUM which is unexpected like </p>
  
  <pre><code>Reading page 1
  SQL used for reading remaining pages: [SELECT * FROM (SELECT application_id, upper(appication_status)  as application_status,relationship_code, create_date,submission_date,transmission_date,TRANSMISSION_STATUS,tpa_notes,site_details_id,transaction_num,PROCESS_STATUS,process_date,application_status_date,first_name,middle_name,last_name,suffix,prefix,APPROVED_REJECTED_DATE,action_by,ass_acronym,user_name,applicant_name,site_name,ASSOCIATION_ID, (TO_DATE('2016-06-29', 'yyyy-mm-dd') - trunc(create_date)) as elapsedDays FROM VIEW_SUMMARY_APPLICATION WHERE (upper(application_status)='PENDING' OR (upper(application_status) IN ('APPROVED','DECLINED') AND trunc(application_status_date) = TO_DATE('2016-06-29', 'yyyy-mm-dd'))) and TRANSACTION_NUM &gt;= :minId and TRANSACTION_NUM &lt;= :maxId ORDER BY transaction_num ASC) WHERE ROWNUM &lt;= 10 AND ((transaction_num &gt; :_transaction_num))]
  Using parameterMap:{minId=100000002596, maxId=100000002629, _transaction_num=100000002622}
  </code></pre>
  
  <p><strong>FYI. TRANSACTION_NUM is not unique.</strong></p>