如题,在action中注入多个service进行事务操作,要求所有事务一次性成功或者失败?失败数据怎么回滚?
[code="java"] class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allManagerMethod"
expression="execution(* byd.service.impl.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod" />
</aop:config>[/code]
使用 Programming Transaction 自己控制事务边界。。。
自己看 Spring 参考手册中有关
TransactionTemplate 使用。