如何在spring批处理编写器中使用ORALCE SQL SEQUENCE。

时间:2015-12-30 12:30:19

标签: spring spring-batch

有人可以让我知道如何在spring batch writer中使用oracle序列吗?

我尝试在insert语句中使用custseq.nextval,但它失败了。

<bean id="testSSRReader"
    class="org.springframework.batch.item.database.JdbcCursorItemReader">
    <property name="dataSource" ref="bconnectedDataSource" />
    <property name="sql"
        value="select CUST_USA_ID , CUST_FIRST_NAME , CUST_LAST_NAME from BL_CUSTOMER fetch first 100 rows only" />
    <property name="rowMapper">
        <bean class="com.macys.batch.rowmapper.TestSSRRowMapper" />
    </property>
</bean>

<bean id="testSSRProcessor" class="com.macys.batch.processor.TestSSRProcessor" />
<bean id="testSSRWriter"
    class="org.springframework.batch.item.database.JdbcBatchItemWriter">
    <property name="dataSource" ref="ocDataSource" />
    <property name="sql">
        <value>
            <![CDATA[        
                insert into TESTTABLESSR(CUSTOMER_ID,CUSTOMER_NAME,CITY)
                     VALUES (custseq.nextval,:firstName,:lastName)
                ]]>
        </value> 
    </property>
    <property name="itemSqlParameterSourceProvider" ref="itemSqlParameterSourceProvider" />
</bean>

0 个答案:

没有答案