I have an application that needs to access two databases. I am trying to use Spring transactions to accomplish this.
1) Since I have two databases and a transaction manager takes a datasource as a parameter, must I configure two transaction managers, with each @Transactional specifying the correct transaction manager to use? ex: @Transcational("database1"), @Transactional("database2").
2) Since @EnableTransactionManagement will look for a single transaction manager to use for all transactions, I do not think I can use this annotation. Is that the case? Can I still utilize transactions with @Transactional("database") and no @EnableTransactionManagement?
Please look to the relevant documentation: http://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/transaction.html#tx-multiple-tx-mgrs-with-attransactional
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With