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

相关推荐
大模型玩家七七12 小时前
基于语义切分 vs 基于结构切分的实际差异
java·开发语言·数据库·安全·batch
Dimpels1 天前
CANN ops-nn 算子解读:AIGC 批量生成中的 Batch 处理与并行算子
开发语言·aigc·batch
Rainly20004 天前
java原生实现企业级spring batch数据迁移
java·spring·batch
香芋Yu6 天前
【深度学习教程——01_深度基石(Foundation)】05_数据太多怎么吃?Mini-batch训练的设计模式
深度学习·设计模式·batch
Hello.Reader7 天前
Flink 自适应批执行(Adaptive Batch Execution)让 Batch 作业“边跑边优化”
大数据·flink·batch
杨_晨12 天前
大模型微调训练FAQ - Batch Size与参数配置
人工智能·机器学习·ai·语言模型·batch
wtsolutions19 天前
Sheet-to-Doc Supports JSON and JSONL: New Way to Batch Generate Word Documents
json·word·batch
空山新雨后、19 天前
小数据集训练 300 epoch 夸张吗?(讲清epoch step batch )
人工智能·深度学习·机器学习·batch
一瞬祈望1 个月前
⭐ 深度学习入门体系(第 18 篇): Batch Size:为什么它能影响训练速度与泛化能力?
人工智能·深度学习·batch
Hello.Reader1 个月前
PyFlink Table Arrow 原理、Exactly-Once、Batch Size、内存风险与最佳实践
开发语言·batch