tux
tux

Reputation: 55

EnableTransactionManagement for multiple databases in Spring

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?

Upvotes: 3

Views: 1527

Answers (1)

Related Questions