0

I would like to execute a Stored Procedure using spring JdbcBatchItemWriter. My current code looks like :

<bean id="xyzWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter">
......
<property name="sql" value="update abc where x=:paramX" />
......
</bean>

I would like to replace this update sql query with a Stored Proc call. I would like to handle it in the xml file itself. Any help is really appreciated.

Thanks

skaffman
  • 398,947
  • 96
  • 818
  • 769
user1019072
  • 299
  • 1
  • 7
  • 17
  • did you try to search here or in general ? here i found http://stackoverflow.com/questions/5950331/stored-procedure-call-with-spring-framework and from looking at the spring(core) jdbc doc i am sure you need to write some custom code to get what you want, basically an own DAO implementation – Michael Pralow Jan 31 '12 at 19:06

1 Answers1

0

Did you tried running SP through JdbcBatchItemWriter? because I also had same requirement and i just tried and it worked for me

<bean id="trackItemWriter" class="org.springframework.batch.item.database.JdbcBatchItemWriter">
        <property name="dataSource" ref="mySQLDatasource"/>
        <property name="itemPreparedStatementSetter">
            <bean class="com.MyDataPreparedStatmentSetter"/>
        </property>
        <property name="assertUpdates" value="false" />
        <property name="sql" value="Call my_Stored_Proc (?,?,?,?)"/>
    </bean>

Hope it helps.

sandeep
  • 996
  • 2
  • 11
  • 22