AOP数据库操作回滚配置
来源:互联网 发布:mac grapher 编辑:程序博客网 时间:2024/06/17 03:16
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd "> <!-- 使用声明式事务配置,可以有效规范代码 --> <!-- 事务管理器 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"/> </bean> <!-- 通知 事务回滚 --> <!-- readonly是设置操作权限为只读,一般用于查询的方法,优化作用 --> <!-- 注解用 rollback-for) 定义当遇到Exception异常 时 回滚 --> <!-- REQUIRED:如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中。这是最常见的选择 --> <!-- REQUIRES_NEW:新建事务,如果当前存在事务,把当前事务挂起 --> <!-- SUPPORTS:支持当前事务,如果当前没有事务,就以非事务方式执行 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="save*" propagation="REQUIRED" rollback-for="Exception"/> <tx:method name="insert*" propagation="REQUIRED" rollback-for="Exception"/> <tx:method name="update*" propagation="REQUIRED" rollback-for="Exception"/> <tx:method name="delete*" propagation="REQUIRED" rollback-for="Exception"/> <tx:method name="find*" propagation="SUPPORTS" read-only="true"/> <tx:method name="select*" propagation="SUPPORTS" read-only="true"/> <tx:method name="get*" propagation="SUPPORTS" read-only="true"/><tx:method name="log" propagation="REQUIRES_NEW" rollback-for="Exception"/><!-- 记录日志专用,在主事务回滚后日志仍记录成功 --> </tx:attributes> </tx:advice> <!-- aop --> <aop:config><aop:pointcut id="serviceMethod" expression="execution(* cn.itcast.ssm.service.*Impl.*.*(..))" /> <aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" /> </aop:config></beans>
阅读全文
0 0
- AOP数据库操作回滚配置
- spring aop事务配置,事务回滚
- oralce数据库的回滚操作原理
- [搬家前]数据库操作的回滚
- SAP EJB 的数据库回滚操作
- java 数据库操作,事务回滚
- 数据库操作失败就【回滚】
- javaEE数据库操作的回滚问题
- Oracle数据库操作(新建数据库,导入数据,回滚)
- Java 中对数据库操作时的 回滚
- Mysql数据库日志,备份及回滚操作
- Junit进行数据库操作时事务自动回滚
- 回滚操作
- 回滚操作
- oracle回滚操作
- GitHub 回滚操作
- git回滚操作
- 数据库回滚
- Sublime搭建Java、C开发环境
- C#读取CSV文件并保存进数据库
- Linux 使用chattr设置文件属性
- 微信小程序——智能小秘“遥知之”源码分享(语义理解基于olami)
- 经典利用信号量实现同步的问题
- AOP数据库操作回滚配置
- 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calc
- CentOS6.5下Hadoop2.8.1编译
- 快速排序算法
- ubuntu 网易云音乐安装
- jquery
- Python笔记(四)--变量类型之字符串
- .NET漫游指南-004-在dataGrid中添加CheckBox支持单选,多选,全选功能
- extjs 数据之间的互转