Spring Batch Transaction issue


This Content is from Stack Overflow. Question asked by vaibhav

I am implementing application using spring Batch. I am following ItemReader, processor, ItemWriter Approach. I have created Partitioner component which is partitioning Data. Through ItemReader I am reading Data and processing it.
After processing I am writing back data in DB. Once job is finished, I observed there is some data missing in DB. Sometimes execution of the one partition fails.. It is random.
How Spring Batch creates Transactions. Is it transaction per Partition ? Or do we need to maintain thread synchronization ?


  • Total no of records – 1000
  • chunk – 100
  • Partition1 – 500
  • Partition2 – 500


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?