问题
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