Skip to content

Commit d36db64

Browse files
committed
Update JPA samples to use the new chunk-oriented step implementation
1 parent 8018705 commit d36db64

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spring-batch-samples/src/main/java/org/springframework/batch/samples/jpa/JpaJobConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,8 +70,8 @@ public JpaItemWriter<CustomerCredit> itemWriter(EntityManagerFactory entityManag
7070
public Job job(JobRepository jobRepository, JpaTransactionManager jpaTransactionManager,
7171
JpaPagingItemReader<CustomerCredit> itemReader, JpaItemWriter<CustomerCredit> itemWriter) {
7272
return new JobBuilder("ioSampleJob", jobRepository)
73-
.start(new StepBuilder("step1", jobRepository)
74-
.<CustomerCredit, CustomerCredit>chunk(2, jpaTransactionManager)
73+
.start(new StepBuilder("step1", jobRepository).<CustomerCredit, CustomerCredit>chunk(2)
74+
.transactionManager(jpaTransactionManager)
7575
.reader(itemReader)
7676
.processor(new CustomerCreditIncreaseProcessor())
7777
.writer(itemWriter)

spring-batch-samples/src/main/java/org/springframework/batch/samples/jpa/JpaRepositoryJobConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,8 +83,8 @@ public RepositoryItemWriter<CustomerCredit> itemWriter(CustomerCreditCrudReposit
8383
public Job job(JobRepository jobRepository, JpaTransactionManager jpaTransactionManager,
8484
RepositoryItemReader<CustomerCredit> itemReader, RepositoryItemWriter<CustomerCredit> itemWriter) {
8585
return new JobBuilder("ioSampleJob", jobRepository)
86-
.start(new StepBuilder("step1", jobRepository)
87-
.<CustomerCredit, CustomerCredit>chunk(2, jpaTransactionManager)
86+
.start(new StepBuilder("step1", jobRepository).<CustomerCredit, CustomerCredit>chunk(2)
87+
.transactionManager(jpaTransactionManager)
8888
.reader(itemReader)
8989
.processor(new CustomerCreditIncreaseProcessor())
9090
.writer(itemWriter)

0 commit comments

Comments
 (0)