I have a requirement to execute eleven SQL SELECT queries sequentially in Spring Batch reader. These SELECT SQLs do INNER JOIN
on quite big tables and diff from each other by a single column name in WHERE
clause.
Output object type by all these readers would be same, lets say VO
.
So how do I achieve that?
I can pass where clause String
in reader which would further set in query provider.
@Bean
public ItemReader<VO> reader(String whereClause, @Value("#{stepExecutionContext[partitionNumber]}") String partitionNumber){
}
I am not sure as how to construct Spring Batch step which sets up these eleven SQLs in readers sequentially and executes them sequentially too. There would be single processor and single writer since output type of all readers is same.
Source of all these readers would be same DB tables and I would like to use JdbcPagingItemReader
due to paging functionality.
My current reader is part of a partitioned step where String partitionNumber
is the partitioning criteria.
What I meant to ask is , can I chain readers if their output type is common? I don't have a problem if these readers get kicked sequentially but can I define a step consisting of a chain of readers for a single processor and writer?
Please suggest for solution or better strategies.