Does jobRepository have to use the same transaction manager as the JdbcBatchItemWriter?

孤人 提交于 2019-12-11 05:04:36

问题


I am developing a Spring Batch enterprise application. The objective of the application is to write records to a table in a legacy database from the company I work for. That database is really big boy that stores business and customer information in huge number of schemas and tables with hundreds of millions of records, there are also hundreds of applications that connect to it: ERPs, CRMS, internal applications, .com.

Because of that, I cannot create the job metadata tables needed by the jobRepository as I cannot create new tables in that legacy database. But at the same time I need to be able to monitor the jobs so I want jobRepository to point to another datasource.

Should I just create another transaction manager and use it in the jobRepository? I am using tasklet steps with chunk tasks and JdbcBatchItemWriter


回答1:


Yes, they use the same transaction manager. In your situation you need a JTA transaction manager because you write data (batch-medatada and business-data) to two different database. Read this comment and few next; it is well explained.



来源:https://stackoverflow.com/questions/18795882/does-jobrepository-have-to-use-the-same-transaction-manager-as-the-jdbcbatchitem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!