value="update account set cashBalance = (cashBalance - :fee) where accountNumber =
Like the classifying ItemWriter used for step 1, the CompositeItemWriter used in step 5 has two
virtually identical ItemWriters it delegates to. Both are JdbcBatchItemWriters, with only the SQL as the
difference between the two.
applyFeeWriter handles the delegation of items to each of the registered ItemWriters for this step. In
this case, it executes feesUpdateWriter with all the items in the current chunk before moving on to
cashBalanceUpdateWriter . As noted in Chapter 9, each ItemWriter in order processes all the items in the
chunk at once.
When step 5 has completed, all the business processing is finished. The last step is to generate the
customer statements, as covered next.
Generating Monthly Statement
The end goal of this batch job is to generate a statement for each customer with a summary of their
account. All the processing up to this point has been about updating and preparing to write the
statement. Step 6 is where you do that work. This section looks at the processing involved writing the
Reading the Statement Data
When you look at the expected output of this last step, you quickly realize that a large amount of data
needs to be pulled in order to generate the statement. Before you get into how to pull that data, let's look
at the domain object you use to represent the data: the Statement object (see Listing 10-41).
Listing 10-41. Statement.java