I need to be able to switch between multiple DataSources (only a single one at a time), the JDBC URL's for these DataSources being generated dynamically by the application (essentially a new database is being created, or an exisiting one re-opened).
Configuring a TransactionProxyFactoryBean to maange the transactional behaviour of a "fixed" DataSource is straight forward, and I'd like to be able to retain the IoC aspects involved here.
Essentially what I'm wanting to do is to switch out one DataSource for a new one, either creating a new transactional proxy, or (preferably?) using the existing one.
Can I use the DelegatingDataSource, and just switch the underlying DataSource for the new one, or does the DataSource used by the transaction manager need to see the underlying DataSource, not the proxy?
Suggestions or alternatives welcome!
Tim


Reply With Quote
) I read that this should work, so I'm unclear on whether this is really the right answer.