[英]How to call a stored procedure from a Spring Batch Tasklet?
It is mentioned that a TaskletStep in Spring Batch can be used to call a stored procedure.提到Spring Batch中的TaskletStep可以用来调用存储过程。 Could anyone provide an example of how to invoke a Stored Procedure from a TaskletStep?
谁能提供一个如何从 TaskletStep 调用存储过程的示例? So far I have done this but it throws an exception saying " Configuration problem: The element [callStoredProcedure] is unreachable"
到目前为止,我已经这样做了,但它抛出了一个异常,说“配置问题:元素 [callStoredProcedure] 无法访问”
<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 Java 类
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 to receive any pointers?
将不胜感激收到任何指点?
Instead of代替
value="call stored_procedure()"
just put就放
value="stored_procedure"
without () on end.没有 () 结束。 That should resolve your issue
那应该可以解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.