2

I am using 2.2.7.RELEASE version of Spring Batch in my project. I have a batch which is using JdbcPagingItemReader to read records from DB2. In that I have a JOIN on 2 tables and have some where conditions. At the last I am providing column by which I want to sort my records. But because I am using table aliases, its giving me error. When skipping alias name, then its give problem while fetching the next set of result. I searched and found that this issue got resolved in 2.1.9 Release but I couldn't find the fix in later releases. Anybody has any idea about this issue and the solution too.

You can find the code snippet of query configuration below.

<bean id="releaseSqlPagingQueryProvider" class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="selectClause" value="SELECT M.* " />
<property name="fromClause" value="FROM MASTER AS M JOIN RELEASE AS R ON M.EMPLOYEE_ID = R.EMPLOYEE_ID " />
<property name="whereClause" >
    <value>
         <![CDATA[
                WHERE R.COLUMN_1 = ? 
          ]]>
     </value>
</property>                 
<property name="sortKey" value="EMPLOYEE_ID" />

Michael Minella
  • 20,843
  • 4
  • 55
  • 67
NGR
  • 1,230
  • 2
  • 15
  • 44
  • This issue is fixed in the latest version of Spring Batch (3.0.4). – Michael Minella May 15 '15 at 15:01
  • Thanks Michael. When this new Release is expected. As far as my knowledge, releases are done till 3.0.3. – NGR May 16 '15 at 15:36
  • 3.0.4 will be out next week. – Michael Minella May 16 '15 at 16:19
  • Hi. I checked it in 3.0.4. But this fix is still missing from latest release. – NGR Jun 09 '15 at 09:58
  • Can you create a jira issue for this with an example we can test against? – Michael Minella Jun 09 '15 at 14:28
  • I have created new JIRA issue (Spring Batch/BATCH-2394). Kindly make corrections if required and let me know if more information is required. Thanks a lot Michael for looking into this issue personally. – NGR Jun 10 '15 at 07:36
  • @MichaelMinella - I am getting the same error when using the JOIN QUERY: Could you please guide me here: https://stackoverflow.com/questions/62519493/partitions-and-jdbcpagingitemreader-doesnt-gives-correct-values ? – PAA Jun 23 '20 at 12:12
  • Answered it in another question: https://stackoverflow.com/a/70357862/1909708 – Himadri Pant Dec 15 '21 at 02:47

0 Answers0