http://www.tkk7.com/jinfeng_wang/archive/2005/03/04/1683.html
Spring Transaction:通過Template+Callback機制,實現對各種事務的統一封裝。
<bean id="transactionManager" //對JDBC Transaction的封裝
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<bean id="transactionManager" //對Hibernate事務的封裝
class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<bean id="transactionManager"http://對JDO事務的封裝
class="org.springframework.orm.jdo.JdoTransactionManager">
<property name="persistenceManagerFactory">
<ref bean="persistenceManagerFactory"/>
</property>
</bean>
<bean id="transactionManager" //對JTA 事務的封裝
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName">
<value>java:/TransactionManager</value>
</property>
</bean>
<bean id="courseService"http://利用AOP,將TransactionManager和普通的Service編織起來,實現事務。
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="proxyInterfaces">//編織后對外的接口
<list>
<value>com.springinaction.training.service.CourseService</value>
</list>
</property>
<property name="target">//目標
<ref bean="courseServiceTarget"/>
</property>
<property name="transactionManager">//植入的事務管理者
<ref bean="transactionManager"/>
</property>
<property name="transactionAttributeSource">//事務的參數(隔離度,方法名等)
<ref bean="attributeSource"/>
</property>
</bean>