Spring Batch之读数据库—StoredProcedureItemReader(四十)

一、StoredProcedureItemReader

Spring Batch框架对存储过程提供了支持,StoredProcedureItemReader提供了对存储过程的支持,其运行和JdbcCursorItemReader类似,均是获取游标对象,然后转换为JavaBean对象。

StoredProcedureItemReader关键属性:

属性 类型 说明
function Boolean 是否调用存储过程的function
parameters SqlParameter 存储过程的参数类型
procedureName String 调用的存储过程名称
refCursorPosition int 使用OUT类型参数时候,指定OUT类型参数在参数列表中的位置,index的列表从0开始。 默认值:0

二、项目举例

1.项目框架

2.代码实现

D:\ideaWorkplace(旧)\spring-batch\src\main\java\com\xj\demo31\BatchMain.java:

D:\ideaWorkplace(旧)\spring-batch\src\main\java\com\xj\demo31\CreditBill.java:

D:\ideaWorkplace(旧)\spring-batch\src\main\java\com\xj\demo31\CreditBillProcessor.java:

D:\ideaWorkplace(旧)\spring-batch\src\main\java\com\xj\demo31\DummyCreditItemWriter.java:

D:\ideaWorkplace(旧)\spring-batch\src\main\resources\demo31\job\demo31-job.xml:

D:\ideaWorkplace(旧)\spring-batch\src\main\resources\demo31\job\demo31-jobContext.xml:

D:\ideaWorkplace(旧)\spring-batch\src\main\resources\demo31\db\create-stored-procedure-mysql.sql:

D:\ideaWorkplace(旧)\spring-batch\src\main\resources\demo31\db\create-tables-mysql.sql:

D:\ideaWorkplace(旧)\spring-batch\src\main\resources\properties\batch-mysql.properties:

3.运行结果

相关推荐
Hello.Reader13 小时前
Flink 执行模式在 STREAMING 与 BATCH 之间做出正确选择
大数据·flink·batch
ps酷教程11 天前
spring-batch深入了解
java·spring·batch
relis1 个月前
解密llama.cpp中的batch与ubatch:深度学习推理优化的内存艺术
深度学习·batch·llama
九年义务漏网鲨鱼1 个月前
PyTorch DDP 随机卡死复盘:最后一个 batch 挂起,NCCL 等待不返回
人工智能·pytorch·batch
hllqkbb2 个月前
从 SGD 到梯度累积:Epoch、Batch、Step 的关系全解析
开发语言·人工智能·opencv·计算机视觉·batch
wtsolutions2 个月前
Batch Conversion Online JSON Files (from URL) to Excel by WTSolutions
json·excel·batch
开开心心就好2 个月前
PDF转图片工具,一键转换高清无损
服务器·前端·智能手机·r语言·pdf·excel·batch
巴伦是只猫3 个月前
【深度学习笔记 Ⅱ】8 mini-batch 梯度下降法
笔记·深度学习·batch
开开心心_Every3 个月前
免费PDF文件格式转换工具
java·智能手机·pdf·word·batch·java-zookeeper
山海上的风3 个月前
Spring Batch终极指南:原理、实战与性能优化
spring·性能优化·batch·springbatch