How to call a stored procedure from a batch Tasklet Spring?
Specifies that TaskkeyStep in Spring Batch can be used to call a stored procedure. Can anyone provide an example of calling a stored procedure from a TaskletStep? So far I've done this, but it throws an exception: "Config problem: [callStoredProcedure] item is not available"
<job id="job1">
<step id="step1">
<tasklet ref="myTasklet"/>
</step>
</job>
<bean id="myTasklet" class="MyClass">
<property name="dataSource" ref="dataSource"/>
<property name="sql" value="call stored_procedure()"/>
</bean>
Java class
class MyClass implements Tasklet{
@Override
public RepeatStatus execute(StepContribution contribution,
ChunkContext chunkContext) throws Exception {
JdbcTemplate myJDBC=new JdbcTemplate(getDataSource());
myJDBC.execute(sql);
return RepeatStatus.FINISHED;
}
}
How and where should the stored procedure be configured? Would be grateful for getting any pointers?
Thanks and greetings
+3
source to share