Hi,
I am using spring4 and hibernate 4. My application need to store data in two different databases. The access to the database are transactional, so I use @Transactional annotation. However, transactions on database1 do not need to be aware of transactions on database2. So I though I could just create two databasource bean, two sessionFactory bean and then create two different HibernateTransactionManager bean, each one against each sessionFactory. The problem with that approach is that I get a UniqueBeanException, as the TransactionAspectSupport.determineTransactionManager is retrieving all beans implementing the PlatformTransactionManager and expects only one instance.
Basically, how could I configure my application, so that spring knows that for a sessionFactory1, it needs to use Manager1 and that for sessionFactory2, it needs to use Manager2 ?
Thanks and Regards,
Mel.
|