尝试使用 Spring Batch 读取昨天才创建的数据。下面是我尝试使用 JdbcPagingItemReader 和 SqlPagingQueryProviderFactoryBean 的 bean。但是,查询没有被执行。
感谢您的帮助!
<bean id="customersPagingItemReader"
class="org.springframework.batch.item.database.JdbcPagingItemReader"
scope="step">
<property name="dataSource" ref="dataSource" />
<property name="queryProvider">
<bean
class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="selectClause" value="SELECT CUST_ID, CREATED " />
<property name="fromClause" value=" from CUSTOMERS" />
<property name="whereClause" value=" where CREATED >= trunc(SYSDATE-1) and CREATED < trunc(SYSDATE)" />
</bean>
</property>
<property name="pageSize" value="5" />
<property name="fetchSize" value="5" />
<property name="rowMapper">
<bean class="com.yahoo.affiliationapi.api.CustomerRowMapper" />
</property>
</bean>
最佳答案
我能够弄清楚这一点。当我查看作业步骤退出消息时显示 -“必须指定 sortKey”
我刚刚将以下属性添加到上面的代码中,它开始正常工作。
<property name="sortKey" value="CUST_ID" />
关于java - Spring Batch 在Where子句中使用>=和<,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44169321/