2
votes

I have spring batch job which perform following steps

  1. Read from Database
  2. Process record and fetch relative details from other system
  3. Identify target data to be updated
  4. Composite item writer for database for multiple targets ( currently I have two targeted tables, two jdbc Writers)

Now the issue is this composite item writer fail if any of jdbc item writer don’t update row due to condition is not matched or to be skipped.

Use case is

  1. Either all item Writers to be skipped- This is done by returning null object from processor
  2. All Item Writers updates - No issue
  3. Some Writers needs to update and some needs to be skipped- need help to resolve this.
1

1 Answers

1
votes

The idea of wrapping each chunk in a transaction is to be able to process the whole chunk of items as a unit: either all items are committed or none of them is committed (all or nothing semantics).

Some Writers needs to update and some needs to be skipped- need help to resolve this.

If you need fine grained control like that, you need to create a custom writer.