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

相关推荐
白熊1885 天前
【机器学习基础】机器学习入门核心算法:Mini-Batch K-Means算法
算法·机器学习·batch
码界奇点12 天前
Kafka性能调优三剑客:深度解析buffer_memory、linger_ms和batch_size
性能优化·kafka·散列表·linq·batch
每天都要写算法(努力版)1 个月前
【神经网络与深度学习】批标准化(Batch Normalization)和层标准化(Layer Normalization)
深度学习·神经网络·batch
意.远2 个月前
批量归一化(Batch Normalization)原理与PyTorch实现
人工智能·pytorch·python·深度学习·神经网络·分类·batch
Ronin-Lotus2 个月前
深度学习篇---模型参数调优
人工智能·pytorch·python·深度学习·paddlepaddle·batch·学习率
爱的叹息2 个月前
一个完整的 Spring Batch + RepositoryItemWriter + CrudRepository 示例,包含详细注释说明
windows·spring·batch
爱的叹息2 个月前
Spring Batch ItemWriter 常见实现类及对比(含 RepositoryItemWriter)
java·spring·batch
tortorish3 个月前
PyTorch中Batch Normalization1d的实现与手动验证
人工智能·pytorch·batch
Jeremy_10223 个月前
SpringBatch之ResultSet.next()
spring·batch
HXQ_晴天3 个月前
深度学习中卷积层(Conv)、BN层(Batch Normalization)和 ReLU层(Rectified Linear Unit)的详细介绍
人工智能·深度学习·batch