Reputation: 1615
Can a TransactionProxyFactoryBean have multiple targets, for example curretnly the target prop spans one DAO like:
<bean id="client" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="target"><ref local="ClientDAO"/></property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
could I add another DAO into the target property for the same proxyfactory bean.
Or do I have to have a seperate transactionproxyBean for each DAO.
Upvotes: 0
Views: 601
Reputation: 236
It is not possible. However, if you want to proxy several DAOs with the same configuration, you can configure the bean as abstract without setting a target, naming it st like myTransactionProxy and then for each target just use
<bean id="client" parent="myTransactionProxy">
<property name="target" ref="ClientDAO"/>
</bean>
...
Anyways, using TransactionProxyFactoryBean is rather old way to manage transactions, try to look at tx namespace to define transactions declaratively (http://www.springframework.org/schema/tx).
Upvotes: 1