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

相关推荐
wtsolutions10 天前
Batch Conversion Online JSON Files (from URL) to Excel by WTSolutions
json·excel·batch
开开心心就好19 天前
PDF转图片工具,一键转换高清无损
服务器·前端·智能手机·r语言·pdf·excel·batch
巴伦是只猫1 个月前
【深度学习笔记 Ⅱ】8 mini-batch 梯度下降法
笔记·深度学习·batch
开开心心_Every1 个月前
免费PDF文件格式转换工具
java·智能手机·pdf·word·batch·java-zookeeper
山海上的风1 个月前
Spring Batch终极指南:原理、实战与性能优化
spring·性能优化·batch·springbatch
超级小忍2 个月前
如何在 Spring Boot 中使用 Spring Batch
spring boot·spring·batch
开开心心就好2 个月前
电脑扩展屏幕工具
java·开发语言·前端·电脑·php·excel·batch
白熊1883 个月前
【机器学习基础】机器学习入门核心算法:Mini-Batch K-Means算法
算法·机器学习·batch
码界奇点3 个月前
Kafka性能调优三剑客:深度解析buffer_memory、linger_ms和batch_size
性能优化·kafka·散列表·linq·batch
每天都要写算法(努力版)4 个月前
【神经网络与深度学习】批标准化(Batch Normalization)和层标准化(Layer Normalization)
深度学习·神经网络·batch