Skip to content

Commit

Permalink
Add isolationLevelForCreate attribute in EnableBatchProcessing
Browse files Browse the repository at this point in the history
Related to #3942
  • Loading branch information
fmbenhassine committed Sep 21, 2022
1 parent e33659c commit 1141975
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ private void registerJobRepository(BeanDefinitionRegistry registry, EnableBatchP
beanDefinitionBuilder.addPropertyValue("tablePrefix", tablePrefix);
}

String isolationLevelForCreate = batchAnnotation.isolationLevelForCreate();
if (isolationLevelForCreate != null) {
beanDefinitionBuilder.addPropertyValue("isolationLevelForCreate", isolationLevelForCreate);
}

beanDefinitionBuilder.addPropertyValue("maxVarCharLength", batchAnnotation.maxVarCharLength());
beanDefinitionBuilder.addPropertyValue("clobType", batchAnnotation.clobType());
registry.registerBeanDefinition("jobRepository", beanDefinitionBuilder.getBeanDefinition());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
* @Import(DataSourceConfiguration.class)
* public class AppConfig {
*
* @Autowired
* private JobRepository jobRepository;
*
* @Bean
* public Job job(JobRepository jobRepository) {
* return new JobBuilder("myJob").repository(jobRepository).start(step1()).next(step2()).build();
Expand All @@ -75,7 +72,7 @@
* Note that only one of your configuration classes needs to have the
* <code>&#064;EnableBatchProcessing</code> annotation. Once you have an
* <code>&#064;EnableBatchProcessing</code> class in your configuration, you have an
* instance of {@link StepScope} and
* instance of {@link org.springframework.batch.core.scope.StepScope} and
* {@link org.springframework.batch.core.scope.JobScope}, so your beans inside steps can
* have <code>&#064;Scope("step")</code> and <code>&#064;Scope("job")</code> respectively.
* You can also use <code>&#064;Autowired</code> to insert some useful beans into your
Expand Down Expand Up @@ -224,6 +221,13 @@
*/
int clobType() default Types.CLOB;

/**
* Set the isolation level for create parameter value. Defaults to
* {@literal ISOLATION_SERIALIZABLE}.
* @return the value of the isolation level for create parameter
*/
String isolationLevelForCreate() default "ISOLATION_SERIALIZABLE";

/**
* Set the task executor to use in the job launcher.
* @return the bean name of the task executor to use. Defaults to
Expand Down

0 comments on commit 1141975

Please sign in to comment.