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.运行结果

相关推荐
添加shujuqudong1如果未回复2 天前
MATLAB 中提取冲击信号的解卷积方法探索
batch
算法与编程之美6 天前
探索不同的损失函数和batch_size对分类精度的影响
开发语言·人工智能·分类·数据挖掘·batch
LDG_AGI14 天前
【推荐系统】深度学习训练框架(七):PyTorch DDP(DistributedDataParallel)中,每个rank的batch数必须相同
网络·人工智能·pytorch·深度学习·机器学习·spark·batch
白日做梦Q15 天前
深度学习调参手册:学习率、Batch Size 的最优搭配策略
深度学习·学习·batch
执笔论英雄25 天前
【大模型训练】forward_backward_func返回多个micro batch 损失
开发语言·算法·batch
算法与编程之美1 个月前
探索不同的优化器、损失函数、batch_size对分类精度影响
人工智能·机器学习·计算机视觉·分类·batch
xier_ran1 个月前
深度学习:Mini-Batch 梯度下降(Mini-Batch Gradient Descent)
人工智能·深度学习·batch
想ai抽2 个月前
Flink的checkpoint interval与mini-batch什么区别?
大数据·flink·batch
Hello.Reader2 个月前
Flink 执行模式在 STREAMING 与 BATCH 之间做出正确选择
大数据·flink·batch
ps酷教程3 个月前
spring-batch深入了解
java·spring·batch