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

相关推荐
Rainly200013 小时前
java原生实现企业级spring batch数据迁移
java·spring·batch
香芋Yu2 天前
【深度学习教程——01_深度基石(Foundation)】05_数据太多怎么吃?Mini-batch训练的设计模式
深度学习·设计模式·batch
Hello.Reader3 天前
Flink 自适应批执行(Adaptive Batch Execution)让 Batch 作业“边跑边优化”
大数据·flink·batch
杨_晨9 天前
大模型微调训练FAQ - Batch Size与参数配置
人工智能·机器学习·ai·语言模型·batch
wtsolutions16 天前
Sheet-to-Doc Supports JSON and JSONL: New Way to Batch Generate Word Documents
json·word·batch
空山新雨后、16 天前
小数据集训练 300 epoch 夸张吗?(讲清epoch step batch )
人工智能·深度学习·机器学习·batch
一瞬祈望23 天前
⭐ 深度学习入门体系(第 18 篇): Batch Size:为什么它能影响训练速度与泛化能力?
人工智能·深度学习·batch
Hello.Reader1 个月前
PyFlink Table Arrow 原理、Exactly-Once、Batch Size、内存风险与最佳实践
开发语言·batch
Hi梅1 个月前
批量处理框架 (Batch Processing Framework)
java·服务器·batch
廋到被风吹走1 个月前
【Spring】Spring Batch 详细介绍
java·spring·batch