<bean id="dataSource" class="...jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>MyDS</value></property>
</bean>
<bean id="transactionManager"
class="...transaction.jta.JtaTransactionManager"/>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
...
</bean>
<bean id="transactionManager"
class="...jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>
<bean id="sessionFactory"
class="...orm.hibernate.LocalSessionFactoryBean">
...
</bean>
<bean id="transactionManager"
class="...orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
PlatformTransactionManager transactionManager =
(PlatformTransactionManager) ctx.getBean("myTransactionManager");
TransactionTemplate transaction =
new TransactionTemplate(transactionManager);
transaction.execute(new TransactionCallbackWithoutResult() {
public void doInTransactionWithoutResult(TransactionStatus s) {
updateOperation1();
updateOperation2();
}
});
<bean id="txAttributes"
class="...MatchAlwaysTransactionAttributeSource">
<property name="transactionAttribute">
<value>PROPAGATION_REQUIRED</value>
</property>
</bean>
<bean id="txInterceptor"
class="...transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="myTransactionManager"/>
</property>
<property name="transactionAttributeSource">
<ref bean="txAttributes"/>
</property>
</bean>
<bean id="txAttributes"
class="...interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<value>
get*=PROPAGATION_REQUIRED,readOnly
find*=PROPAGATION_REQUIRED,readOnly
load*=PROPAGATION_REQUIRED,readOnly
store*=PROPAGATION_REQUIRED
</value>
</property>
</bean>
<bean id="autoProxyCreator"
class="...framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames">
<value>txInterceptor</value>
</property>
<property name="beanNames">
<value>*Dao</value>
</property>
</bean>
<bean id="autoproxy"
class="...aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
</bean>
<bean id="txAdvisor"
class="...transaction.interceptor.TransactionAttributeSourceAdvisor"
autowire="constructor">
</bean>
<bean id="txInterceptor"
class="...transaction.interceptor.TransactionInterceptor"
autowire="byType">
</bean>
<bean id="txAttributeSource"
class="...transaction.interceptor.AttributesTransactionAttributeSource"
autowire="constructor">
</bean>
<bean id="attributes"
class="...metadata.commons.CommonsAttributes">
</bean>