spring - Which is the default transaction manager the @Transactional uses? -


we have configured multiple transaction managers:

<tx:annotation-driven transaction-manager="transactionmanager1" /> <tx:annotation-driven transaction-manager="transactionmanager2" /> <tx:annotation-driven transaction-manager="transactionmanager3" />  <bean id="transactionmanage1"     class="org.springframework.orm.hibernate4.hibernatetransactionmanager">     <property name="sessionfactory" ref="sessionfactory1" /> </bean> <bean id="transactionmanager2"     class="org.springframework.orm.hibernate4.hibernatetransactionmanager">     <property name="sessionfactory" ref="sessionfactory2" /> </bean> <bean id="transactionmanage3"     class="org.springframework.orm.hibernate4.hibernatetransactionmanager">     <property name="sessionfactory" ref="sessionfactory3" /> </bean> 

however,i don't see name of transaction manager specified in @transactional annotation in service class. wondering transaction manager used? code working , looks used first 1 - "transactionmanager1" default. miss something?

i wondering transaction manager used?

the behaviour there undefined, it's use whichever <tx:annotation-driven> comes first in context.

there's no reason should need this. if need fine-grained control on tx manager use, need programmatically using transactiontemplate. @transactional annotation convenience, isn't flexible using underlying api directly.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -