Repository navigation
Transaction rollback issue for skippable exception migrating to spring batch 6 #5303
Replies: 5 comments 13 replies
|
Ok, it seems like adding |
|
This was actually a regression in v6 which has been fixed in #5210. The fix will be shipped in the upcoming 6.0.3. |
|
I'm closing this discussion for now, but if you need further support, please do not hesitate to add a comment here. Thank you. |
|
Turns out I had set the chunksize 1 by mistake while testing. Setting it to something higher breaks it again (StaleObjectStateException). To get it to work, it seems I need to persist items one by one (in their own transactions). Meaning, adding the annotation mentioned earlier as well as either set chunksize to 1 or Replace This still seems to be the case on 6.0.3 (version overridden in spring boot 4.0.3). |
|
Re-opening the discussion to investigate the JPA setup. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
We have a setup where we intentionally skip constraint violations during inserts. We use a chunked step configured like so
It is supposed to skip items upon database constraint violations, hence the exception type configures in the 'skip'. However after migrating to spring batch 6 (spring boot 4), this skipping no longer works and I get:
A bit further on it logs:
Our writer does a
saveAll()on a JPA repository like this:Seems to me like the exception thrown is marking the transaction as rollback-only before the skip configuration has any chance of skipping the item. All of this worked before the migration. Please advice on how to proceed.
All reactions