Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple SessionFactories, multiple DataSources and Hibernate TransactionManager can take only one Sessionfactory

I have @Transactional annotation in all my DAOs, but I can only define one TransactionManager that takes only one SessionFactory. I have one SessionFactory per customer, one DataSource per customer and apparently I need to change TransactionManager for every customer. But how can I get correct transaction manager for customer, when I can only define one Spring bean name for one TransactionManager?

like image 302
newbie Avatar asked Dec 10 '10 10:12

newbie


1 Answers

Spring 3 has support for multiple transaction managers, while keeping the declarative @Transactional delimitation

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html#tx-multiple-tx-mgrs-with-attransactional

Is this not what you want?

like image 103
octav Avatar answered Oct 19 '22 12:10

octav