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 天前
GPT-5.6 Luna (Batch) 批量处理能力深度评测
java·gpt·batch
典典分享指南12 天前
用结构化数据管理产品知识库
scala·bash·batch·actionscript
mjhcsp15 天前
DeepSeek V4 Flash 0731 (Batch) 深度评测报告
log4j·php·batch
jay神17 天前
深度学习如何确定Batch Size的大小?
人工智能·深度学习·计算机视觉·毕业设计·课程设计·batch
江畔柳前堤22 天前
字节跳动产品全景图:从应用表象到技术深海的七层解剖
人工智能·chatgpt·架构·json·batch
何以解忧,唯有..25 天前
LangChain 模型调用方法总结:invoke、batch、stream 的入参与出参
开发语言·langchain·batch
江畔柳前堤1 个月前
LLM + Agent 模型效果评估:从入门到工业级体系构建的完整指南
开发语言·人工智能·自然语言处理·chatgpt·架构·json·batch
Xiaok10182 个月前
Epoch、Batch 与 DataLoader
开发语言·深度学习·batch
dyxal2 个月前
Batch Size 完全解析:从“手工小作坊”到“自动化流水线”
batch·gpu算力
飞猪~2 个月前
Langchain python版本 LLM 重要函数invoke,ainvoke,stream,astream,batch,abatch
python·langchain·batch