What would be the preferred way to connect to two databases at the same time using hibernate, spring and declarative transactions?
We are trying to migrate data from source database to target database and manually created two Spring contexts with each using its own database.
We are using the "DataSourceTransactionManager" to manage the declarative transaction in each Spring context created. When we manually start both Spring contexts and start both transactions with its own transaction manager, somehow both transactions become synchronized and need to be nested. If they aren't nested an Exception occurs (java.lang.IllegalStateException: Cannot deactivate transaction synchronization - not active). Why did both transactions synchronize? What would be the preferred way to manage the transactions in such a case?
Any suggestion appreciated.