Oct 4th, 2012, 09:24 AM
database to flat file
Is it possible to write the row count on the flat file along with the chunk size and also i have a amount column in a row i need to add them up in every page .when i go through the spring batch in action i think field extractor interface is one of the option .can anyone please help me in this .please suggest me what should i do ?is it possible to calculate the amount in every page ?
Thanks in advance
Oct 4th, 2012, 12:55 PM
Of course, in the StepExecution bean you have the row.count value. To get it, first in the @BeforeStep get the StepExecution parameter and define a new variable in your process of type StepExecution (and @Autowired it). Then, you can use all the counters that the StepExecution manages.
Hope to hep you. If you have any other question, please let me know.
Oct 4th, 2012, 01:26 PM
Oct 5th, 2012, 10:06 AM
The easiest way to handle the aggregation you're talking about is going to be to write your own writer that wraps the FlatFileItemWriter. You can aggregate the records in each chunk there and delegate all actual writing work to the FlatFileItemWriter.