How do I configure Spring Batch (using Java Configuration) to write all chunks in a single transaction?
I have a simple simple Spring Batch Job with a single step. The step is made of a JdbcCursorItemReader
, a custom item processor and a custom item writer. Currently I set the chunk size on the StepBuilder
. This also seems to set the commit interval to the same value. On one hand I don't want to load all items into memory and therefore need chunk oriented processing. On the other hand the processor needs a single transaction over all the items not just the ones in the current chunk. It won't store the items in memory. It's ok if #write
is called several times.
How can this be achieved using Java Configuration?