Open
Description
Mauro Molinari opened BATCH-2171 and commented
I'm new to Spring Batch and my starting point to learn was the reference documentation.
However, after reading it, looking at the examples and reading other books about the subject, I was still with some big questions in my head. I found the replies on a few sources, like:
- http://forum.spring.io/forum/spring-projects/batch/74926-spring-batch-and-transactions
- https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-1-the-basics/
- https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-2-restart-cursor-based-reading-and-listeners/
- https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-3-skip-and-retry/
What I'm referring about:
- the relationship between the Spring Batch metadata and the business logic data regarding transaction management: should they stay in the same transactional resource or not?
- must the transaction manager passed to the
JobRepository
be the same as the one passed to the job steps? Please also note that theJdbcCursorItemReader
represent an exceptional case - what's the answer to the previous questions when you're in a JEE container and/or you are using a JTA-XA infrastructure?
- how can the examples pass a
HibernateTransactionManager
orJpaTransactionManager
so easily to theJobRespotiory
, even if Spring Batch itself does not use Hibernate/JPA? - how exactly are transactions handled for the skip and retry cases? What happens to the chuck processing flow when a skippable/retryable exception is thrown? And how things go instead when this exception is also in
no-rollback-exception-classes
?
I think the developer should know exactly how things work regarding transactions when he/she has to setup a Spring Batch environment and/or to configure jobs appropriately. I personally got almost all my replies by reading the above sources, but I suggest to improve the Spring Batch documentation to cover these topics too.
2 votes, 3 watchers