Spring 中transactionAttributes的合理配置
来源:互联网 发布:21端口入侵工具 编辑:程序博客网 时间:2024/04/27 13:49
<!--配置事务拦截器 -->
<bean id="txIntercept"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManage" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,readonly, -Exception</prop>
</props>
</property>
<bean id="txIntercept"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="txManage" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED,readonly, -Exception</prop>
</props>
</property>
</bean>
transactionAttributes的属性的意义:
PROPAGATION_REQUIRED--支持当前事务,如果当前没有事务,就新建一个事务。这是最常见的选择。
(适用于处理一个或多个交叉insert,update,delete)
PROPAGATION_SUPPORTS--支持当前事务,如果当前没有事务,就以非事务方式执行。
(适用于处理一个或多个交叉insert,update,delete,query)
PROPAGATION_MANDATORY--支持当前事务,如果当前没有事务,就抛出异常。
(适用于检测query是否存在insert,update,delete)
PROPAGATION_REQUIRES_NEW--新建事务,如果当前存在事务,把当前事务挂起。
PROPAGATION_NOT_SUPPORTED--以非事务方式执行操作,如果当前存在事务,就把当前事务挂起。
PROPAGATION_NEVER--以非事务方式执行,如果当前存在事务,则抛出异常。
(适用于全query)
PROPAGATION_NESTED--如果当前存在事务,则在嵌套事务内执行。如果当前没有事务,则进行与PROPAGATION_REQUIRED类似的操作。
-Exception ,这个代表抛出异常,则该方法回滚 -代表回滚 +代表提交
readonly ,一般用于查询的方法,优化作用.
0 0
- Spring 中transactionAttributes的合理配置
- Spring配置中transactionAttributes的意义
- Spring配置中transactionAttributes的意义
- Spring配置中transactionAttributes的意义
- 关于Spring配置中transactionAttributes的意义
- 关于Spring配置中transactionAttributes的意义
- Spring中transactionAttributes的详解
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- Spring配置中transactionAttributes的使用方法和作用
- spring关于“transactionAttributes”的相关配置
- JBOD磁盘磁盘簇
- Perl Tk grid布局管理器<1>
- zend framework2 redis使用遇到的问题
- 设屏幕自适应
- Array.prototype.slice.call(arguments)
- Spring 中transactionAttributes的合理配置
- 桂林北大青鸟平面设计
- -我爱校园作文400字-
- android手势创建及识别
- 给手游开发者的7个建议
- 进制间的相互转换
- gitlab搭建问题总结
- 经典SQL语句大全
- [C++]LeetCode: 110 Spiral Matrix (螺旋输出矩阵元素)