I am trying to build a job in spring batch to perform below actions :
- Read CSV file
- Dump CSV files into a table
- Call Stored Procedure to perform some action
I am able to write logic for the first 2 points but not sure how to call a Stored procedure? Also, this procedure should be called after first 2 points are completed, so thinking this should be in another step.
Based on my assumption, I should have a job configuration like this :
@Bean
    public Job job(){
        return jobBuilderFactory.get("job")
                .start(step1())  --> To read and write CSV file
                .next(step2())   --> To call SP
                .incrementer(new RunIdIncrementer())
                .build();
    }
Below is my step configuration :
In this step, I am reading 1000 Provider objects at a time from csv and dumping it into a table. This is working as expected.
@Bean
    public Step step1(){
        return stepBuilderFactory.get("step1")
                .<Provider, Provider>chunk(1000)
                .reader(batchItemReader.providerMultiResourceItemReader())
                .writer(batchItemWriter.providerJdbcBatchItemWriter())
                .build();
    }
To call Stored procedure : SP_UpdateTemp, I am thinking to include step2() but now sure how to do it ? In this SP, I am reading records from first table and performing some updates on another table.
@Bean
    public Step step2(){
        return stepBuilderFactory.get("step2")
                //call procedure
    }
 
    