RESOLVED: BATCH-1501 - paging queries fixed for sort key not in first column of query

This commit is contained in:
dsyer
2010-02-04 10:07:10 +00:00
parent 5ed6f03756
commit 164b322173
5 changed files with 28 additions and 5 deletions

View File

@@ -17,7 +17,8 @@
<bean class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="sortKey" value="ID" />
<property name="selectClause" value="select ID, NAME, CREDIT" />
<!-- Intentionally put sort key second in the query list as a test -->
<property name="selectClause" value="select NAME, ID, CREDIT" />
<property name="fromClause" value="FROM CUSTOMER" />
<property name="whereClause" value="WHERE CREDIT > :credit" />
</bean>

View File

@@ -17,6 +17,7 @@
package org.springframework.batch.sample.iosample;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -57,7 +58,15 @@ public class JdbcPagingRestartIntegrationTests {
ExecutionContext executionContext = new ExecutionContext();
executionContext.putInt("JdbcPagingItemReader.read.count", 2);
((ItemStream)reader).open(executionContext);
assertNotNull(reader.read());
CustomerCredit item = reader.read();
// System.err.println(item);
assertNotNull(item);
item = reader.read();
// System.err.println(item);
assertNotNull(item);
item = reader.read();
// System.err.println(item);
assertNull(item);
}
}