spring2.0事务的嵌套
来源:互联网 发布:手机淘宝体检中心 编辑:程序博客网 时间:2024/06/08 09:50
spring2.0事务的嵌套:
一个ServiceA:
public class ServiceA{
public int transactionDetailService(PaymentDetail detail)
throws ServiceException {
try {
return dao.deletePaymentDetail(detail);
} catch (DAOException ex) {
logger .error("错误发生在:PaymentDetailServiceImpl.deletePaymentdetailService()方法中!");
throw new ServiceException();
}
}
}
另一个ServiceB:
public class ServiceB{
public int deletePaymentInfoService(int payId) throws ServiceException {
try {
PaymentDetail detail = new PaymentDetail();
detail.setPayId(payId);
paymentDetailService.transactionDetailService(detail);
dao.deletePaymentInfo(payId); //如果这里执行删除操作失败的话,那么ServiceB的事务回滚,同时,内嵌事务ServiceA的事务也回滚;即transactionDetailService()中的删除操作回滚。
return 1;
} catch (DAOException ex) {
logger.error("错误发生在:PaymentInfoServiceImpl.deletePaymentInfoService(int payId)方法中!");
throw new ServiceException();
}
}
}
Spring2.0 配置文件:
<aop:aspectj-autoproxy />
<!-- default define, uses transactionManager,default * is readonly -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" />
<tx:method name="update*" />
<tx:method name="*" read-only="true" />
<tx:method name="transaction*" propagation="NESTED" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
<aop:advisor
pointcut="execution(* com.ving.xzfw.service.impl.*Service*.*(..))"
advice-ref="txAdvice" />
</aop:config>
- spring2.0事务的嵌套
- spring2.0 事务配置
- spring2.0中的事务控制
- spring2.0基于Annotation的AOP实现以及AOP事务
- 嵌套事务的问题
- java的事务嵌套
- 事务嵌套的规则
- spring 的嵌套事务
- 事务的嵌套
- spring的嵌套事务
- 事务的嵌套
- spring事务的嵌套
- spring2.x的超easy事务配置。。。
- Spring2.x的事务配置策略
- 配置Spring2.0声明式事务
- spring2.0 , spring2.5的一些区别
- spring2.0与spring2.5的差别
- 嵌套事务的回滚
- 读红马的用C#创建Acticex控件有感
- 系统分析师考试心得
- asp.net 发送邮件代码
- CrystalReports连接数据服务器函数
- 如何高效的将excel导入sqlserver
- spring2.0事务的嵌套
- 此博客已终止!!
- 我爱北京天安门
- 146条经典民间偏方曝光
- YATE内部的消息机制
- Ccc
- 读红马的用C#创建Acticex控件补充两小点
- 高斯投影正反算的代码
- 在 Excel 中查找和替换特殊字符 * 和 ?