Stuck Tasklet step which contains a call to public method annotated with @Transactional #5039
-
| We have a  So far we haven't experienced any problems with the above described implementation. So it did its job flawlessly, but just recently we saw that  
 And I started to worry about this  So I started to look around possible causes and I just came across this comment from @fmbenhassine #5019 (comment) Quote: it is known that using  Do you happen to know where I can find more references/documentation/details to this known issue? Please share any thoughts/tips/ideas on the above! :) Thx! | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| 
 The "problem" with calling transitional methods within a tasklet is about transaction properties. The tasklet is already executed within the scope of a transaction driven by Spring Batch, so any call to an external method that is also defined to run in a transaction should be carefully considered, specifically the isolation level and the propagation behaviour : should that method participate in the current transaction driven by Spring Batch? or should it start its own transaction with  There is nothing that prevents you from calling transactional methods from within a tasklet (ie nested transactions), but in that case you need to consider manually handling the nested transaction's behaviour yourself (commit, rollback). Does this clarify things better? | 
Beta Was this translation helpful? Give feedback.
The "problem" with calling transitional methods within a tasklet is about transaction properties. The tasklet is already executed within the scope of a transaction driven by Spring Batch, so any call to an external method that is also defined to run in a transaction should be carefully considered, specifically the isolation level and the propagation behaviour : should that method participate in the current transaction driven by Spring Batch? or should it start its own transaction with
Propagation.REQUIRES_NEW?There is nothing that prevents you from calling transactional methods from within a tasklet…