Sep 20th, 2012, 09:41 AM
Job level Transactionality in Spring Batch
I know right now there is no such thing as inter-step transactionality in Spring-Batch. I'm developing a complex batch job, with many steps performing several actions in database, and each one is related with the others, in such way that each one of them belongs to the same transaction. The way I understand the Spring-Batch paradigm I'm bound to use one-step job in order to have transactionality. Is there any thought (or any other way) to have some kind of job-level transactionality in lately or future versions?
I also have considered one-step-only job to achieve transactionality. But this way you have to add all your business logic inside one (or more) processor(s). This way, I think you are not following the Spring-Batch concept, by adding all the process complexity in one step, and been confined to use DAOs in the processor to achieve your logic goals.
I have been thinking that the clue could be in "TransactionManager" property, but still looking for the exact way.
P.S: This link suggests me the possibility of using an envelope class with "@Transactional" annotation that will invoke my job and, therefore, shall have an external transaction.
Tags for this Thread