spring中事务隔离等级:
1、Serializable:最严格的级别,事务串行执行,资源消耗最大;2、REPEATABLE READ:保证了一个事务不会修改已经由另一个事务读取但未提交(回滚)的数据。避免了“脏读取”和“不可重复读取”的情况,但是带来了更多的性能损失。3、READ COMMITTED:大多数主流数据库的默认事务等级,保证了一个事务不会读到另一个并行事务已修改但未提交的数据,避免了“脏读取”。该级别适用于大多数系统。4、Read Uncommitted:保证了读取过程中不会读取到非法数据那怎么在spring配置文件中设置事务的隔离等级?找了很久了,网上都是说些事务的等级和传播
也没介绍怎么实现。
1、Serializable:最严格的级别,事务串行执行,资源消耗最大;2、REPEATABLE READ:保证了一个事务不会修改已经由另一个事务读取但未提交(回滚)的数据。避免了“脏读取”和“不可重复读取”的情况,但是带来了更多的性能损失。3、READ COMMITTED:大多数主流数据库的默认事务等级,保证了一个事务不会读到另一个并行事务已修改但未提交的数据,避免了“脏读取”。该级别适用于大多数系统。4、Read Uncommitted:保证了读取过程中不会读取到非法数据那怎么在spring配置文件中设置事务的隔离等级?找了很久了,网上都是说些事务的等级和传播
也没介绍怎么实现。
解决方案 »
- js怎么传递一个上传文件的路径?
- <c:if>用法
- struts 上传图片并生成缩略图如何处理gif 高手进共同探讨!
- 一个关于tag的问题
- 大家一起来帮我看看, 一个比较困惑的JS, JSP , session问题. 我在线等待各位大家的赐教.
- 有过Asp项目向JSP移植经验的朋友请进来看看...
- 请问一个jsp服务器端程序生成的文件怎么能确定它和网页在一个目录下啊,然后想把这个文件下载,怎么实现啊
- [在线急求]servlet环境配置
- 菜鸟请关于教response.sendRedirect的问题
- 请问连接SQL2000的问题
- 求职,小弟有一年的asp.net开发经验,想求一份.net或Java方向的开发工作,自知技术还不到家,期望哪位牛人大哥能带小弟
- 通过JSP下载zip文件,下载的zip文件解压报错。在线等……
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice> 在method中配置那哪些方法被管理
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 这个是spring2.0的配置方式,必须修改头文件,加入schema -->
<tx:advice id="myadvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" read-only="false"/>
<tx:method name="save*" propagation="REQUIRED" read-only="false"/>
<tx:method name="update*" propagation="REQUIRED" read-only="false"/>
<tx:method name="*" propagation="REQUIRED" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="mypointcut" expression="execution(* cn.xiaozejun.biz.imp.*.*(..))"/>
<aop:advisor advice-ref="myadvice" pointcut-ref="mypointcut"/>
</aop:config>当前配置文件的文件头 spring2.0<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" isolation="READ_COMMITTED" />
</tx:attributes>
</tx:advice>
<!--
隔离级别每个数据库都不一样,如果不指定这个属性的话,就是 default
sql Server , Oracle的默认隔离级别为: Read Commited
MySQL 的默认隔离级别为 Repeatable Read
-->
<aop:config>
<aop:pointcut id="services" expression="execution(* com.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="services" />
</aop:config>LZ 最好自己 试一下,这些东西不要 总是看网上查到的东西,并不是那么可靠
很多时候,大多数人都不知道怎么回事,只是只知道这么做,习惯了这么做,也只会这么做
LZ 发这个贴,也不只是想 看其他人(平时.一般.习惯)的做法吧 ?