Transaction Manager Transaction manager issue:
problem Phenomenon: call the DAO Update update data in Tasklet to discover that the database has not changed.
problem Analysis: guess is no commit
Originally, I used the spring batch admin as the batch interface management,
But Spring-batch-admin-manager*.jar internal Data-source-context.xml defines the data source and transaction manager
With the DataSource of my DAO module, transaction manager conflicts.
Two transaction managers are actually used here:
* 1) TransactionManager frame-related tables used for spring batch registration Batch_ start:
* Configured in the data-source-context.xml of Spring-batch-manager.jar.
* Jobrepository, Jobregistry, Joblauncher, Jobservice are all using this transaction manager.
*
* 2) to control the submission and rollback of business logic data in Taskletstep (Invoke DAO),
* So you must be the same object as the MyBatis transaction manager Txmanager in Act-dao to have spring batch automatically commit and rollback in transactiontemplate
* If the transaction manager used by spring batch and DAO is not the same, it will cause the DAO update to be lost.
The original code is automatically injected with the problem, using the above 1) TransactionManager:
@Resource
Platformtransactionmanager TransactionManager;
Taskletstep.settransactionmanager (TransactionManager);
Solution: Taskletstep instead of DAO, use 2) Txmanager
@Resource (name= "Txmanager")
Platformtransactionmanager Txmanager;
Taskletstep.settransactionmanager (Txmanager);