-
Nov 5th, 2012, 11:08 PM
#1
Chunk Processing: failure and rollback
Hi,
I have a simple batch program (reader/writer) with a chunk size of 5.
My input table has 20 numbers (1,2,3...,20)
I am copying these number to output table (chunk size of 5).
My writer is marked as @Transactional(propogation=Propogation.REQUIRES_NE W), so i expect that all the items in the chunk are inserted in same transaction)
When I come first time in my writer, i will have a list size of 5 => [1,2,3,4,5].
I insert the first 3 items, then on 4th item, before insert; i throw an exception deliberately. Since no exception is skipped; the job fails.
But, i notice that 3 items have been inserted to DB; i expected that the chunk of 5 will either all be inserted; or none will be inserted.
Is there any settings that have to be done to make all the items in a chunk insert in same transaction?
Regards,
Pravin
-
Nov 6th, 2012, 05:21 PM
#2
By default, everything should work as you described so without seeing your configuration, it's hard to tell. If you can post your XML, we can look further.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules