Apr 23rd, 2012, 01:23 PM
[Transactions] Dynamic Transaction Manager.
I've been trying to come up with an implementation that'd be able to do the following:
- Get all different SessionFactory and Datasources declared from the Spring context.
- Identify which TransactionManager should be used for each, for example, HibernateTransaction for JDBC, another one for Oracle and so on.
- Create a new TransactionManager for each, and re-use that for other instances being checked.
- Associate that TransactionManager to an advice.
My main problem is envisioning all this idea into code, I've been able to get a hold of most of the beans by creating a new one and implementing "MergedBeanDefinitionPostProcessor", in case I need to check the definitions. However, the problem comes up with the last two steps.
I'm not really sure how to create the TransactionManager programmatically and associate it to an advice... I read about TransactionProxyFactoryBean, but couldn't get much more into it.
The reason to have this done, is that we want to have transaction management for a bunch of datasources/connections that are defined outside of our component, so we need to go through the declared SessionFactories and apply the transaction management aspect for each. So I can't really have anything XML or annotation based.
Please, can you help me out with this? Let me know if you need further information or have any questions.
Thanks a lot in advance!
Last edited by MassivInMensch; Apr 23rd, 2012 at 07:07 PM.
Tags for this Thread