I'm newbie in spring batch and I can't determinate what pattern for reader I would need to use. I need to create the class WSRequestClass and send it to SOAP web service.
public class WSRequestClass{
private String data1;
private String data2;
private String data3;
private String data4;
private List<ClassB> dataList;
}
To create WSRequestClass is necessary:
- Read
data1anddata2from table A. - Read
data3anddata4from table B. The
List<ClassB>should be create from more complex flow. First I get data from query from table C, but the result of this query is aList<ClassA>. I need process each item ofList<ClassA>and convert it toClassB, where some attributes are calculated fromClassA. (Chunk pattern but without writer).public class ClassA { private Date date; private BigDecimal amount1; private BigDecimal amount2; private String data; //getters & setters ... } public class ClassB { private Date date; private BigDecimal amount1; private BigDecimal amount2; private BigDecimal amount3; private BigDecimal amount4; private String data1; private String data2; //getters & setters ... }
I have found multiple examples for simples chunk pattern and tasklets, but none follows this structure. This job use java configuration and JdbcTemplate for queries. The development of the web service call it's done, my only issue is that I have to read from multiple tables and read efficiently the list, transform each item to ClassB and set to WsRequestClass.
Please guide me with the pattern to use, because common ItemReadernot work for me, and I don't know how implement the custom reader that allow me do what I want.