android英语学习群群:118615483,flex群:47964236,这些英语学习群群如...

trackbacks-0
&&& 前段时间对Spring的事务配置做了比较深入的研究,在此之间对Spring的事务配置虽说也配置过,但是一直没有一个清楚的认识。通过这次的学习发觉Spring的事务配置只要把思路理清,还是比较好掌握的。
&&& 总结如下:
&&& Spring配置文件中关于事务配置总是由三个组成部分,分别是DataSource、TransactionManager和代理机制这三部分,无论哪种配置方式,一般变化的只是代理机制这部分。
&&& DataSource、TransactionManager这两部分只是会根据数据访问方式有所变化,比如使用Hibernate进行数据访问时,DataSource实际为SessionFactory,TransactionManager的实现为HibernateTransactionManager。
&&& 具体如下图:
&&& 根据代理机制的不同,总结了五种Spring事务的配置方式,配置文件如下:
&&& 第一种方式:每个Bean都有一个代理
&?xml version="1.0" encoding="UTF-8"?&
&beans xmlns="http://www.springframework.org/schema/beans"
&&& xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&&& xmlns:context="http://www.springframework.org/schema/context"
&&& xmlns:aop="http://www.springframework.org/schema/aop"
&&& xsi:schemaLocation="http://www.springframework.org/schema/beans
&&&&&&&&&& http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/context
&&&&&&&&&& http://www.springframework.org/schema/context/spring-context-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"&
&&& &bean id="sessionFactory"&
&&&&&&&&&&& class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&&
&&&&&&& &property name="configLocation" value="classpath:hibernate.cfg.xml"&/&&
&&&&&&& &property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"&/&
&&& &/bean&&
&&& &!-- 定义事务管理器(声明式的事务) --&&
&&& &bean id="transactionManager"
&&&&&&& class="org.springframework.orm.hibernate3.HibernateTransactionManager"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
&&& &!-- 配置DAO --&
&&& &bean id="userDaoTarget" class="com.bluesky.spring.dao.UserDaoImpl"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
&&& &bean id="userDao"&
&&&&&&& class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&&
&&&&&&&&&& &!-- 配置事务管理器 --&&
&&&&&&&&&& &property name="transactionManager" ref="transactionManager"&/&&&&&
&&&&&&& &property name="target" ref="userDaoTarget"&/&&
&&&&&&&& &property name="proxyInterfaces" value="com.bluesky.spring.dao.GeneratorDao"&/&
&&&&&&& &!-- 配置事务属性 --&&
&&&&&&& &property name="transactionAttributes"&&
&&&&&&&&&&& &props&&
&&&&&&&&&&&&&&& &prop key="*"&PROPAGATION_REQUIRED&/prop&
&&&&&&&&&&& &/props&&
&&&&&&& &/property&&
&&& &/bean&&
&&& 第二种方式:所有Bean共享一个代理基类
&?xml version="1.0" encoding="UTF-8"?&
&beans xmlns="http://www.springframework.org/schema/beans"
&&& xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&&& xmlns:context="http://www.springframework.org/schema/context"
&&& xmlns:aop="http://www.springframework.org/schema/aop"
&&& xsi:schemaLocation="http://www.springframework.org/schema/beans
&&&&&&&&&& http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/context
&&&&&&&&&& http://www.springframework.org/schema/context/spring-context-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"&
&&& &bean id="sessionFactory"&
&&&&&&&&&&& class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&&
&&&&&&& &property name="configLocation" value="classpath:hibernate.cfg.xml"&/&&
&&&&&&& &property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"&/&
&&& &/bean&&
&&& &!-- 定义事务管理器(声明式的事务) --&&
&&& &bean id="transactionManager"
&&&&&&& class="org.springframework.orm.hibernate3.HibernateTransactionManager"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
&&& &bean id="transactionBase"&
&&&&&&&&&&& class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&
&&&&&&&&&&& lazy-init="true" abstract="true"&&
&&&&&&& &!-- 配置事务管理器 --&&
&&&&&&& &property name="transactionManager" ref="transactionManager"&/&&
&&&&&&& &!-- 配置事务属性 --&&
&&&&&&& &property name="transactionAttributes"&&
&&&&&&&&&&& &props&&
&&&&&&&&&&&&&&& &prop key="*"&PROPAGATION_REQUIRED&/prop&&
&&&&&&&&&&& &/props&&
&&&&&&& &/property&&
&&& &/bean&&&&
&&& &!-- 配置DAO --&
&&& &bean id="userDaoTarget" class="com.bluesky.spring.dao.UserDaoImpl"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
&&& &bean id="userDao" parent="transactionBase"&&&
&&&&&&& &property name="target" ref="userDaoTarget"&/&&&
&&& &/bean&
第三种方式:使用拦截器
&?xml version="1.0" encoding="UTF-8"?&
&beans xmlns="http://www.springframework.org/schema/beans"
&&& xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&&& xmlns:context="http://www.springframework.org/schema/context"
&&& xmlns:aop="http://www.springframework.org/schema/aop"
&&& xsi:schemaLocation="http://www.springframework.org/schema/beans
&&&&&&&&&& http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/context
&&&&&&&&&& http://www.springframework.org/schema/context/spring-context-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"&
&&& &bean id="sessionFactory"&
&&&&&&&&&&& class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&&
&&&&&&& &property name="configLocation" value="classpath:hibernate.cfg.xml"&/&&
&&&&&&& &property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"&/&
&&& &/bean&&
&&& &!-- 定义事务管理器(声明式的事务) --&&
&&& &bean id="transactionManager"
&&&&&&& class="org.springframework.orm.hibernate3.HibernateTransactionManager"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&&
&&& &bean id="transactionInterceptor"&
&&&&&&& class="org.springframework.transaction.interceptor.TransactionInterceptor"&&
&&&&&&& &property name="transactionManager" ref="transactionManager"&/&&
&&&&&&& &!-- 配置事务属性 --&&
&&&&&&& &property name="transactionAttributes"&&
&&&&&&&&&&& &props&&
&&&&&&&&&&&&&&& &prop key="*"&PROPAGATION_REQUIRED&/prop&&
&&&&&&&&&&& &/props&&
&&&&&&& &/property&&
&&& &/bean&
&&& &bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&&
&&&&&&& &property name="beanNames"&&
&&&&&&&&&&& &list&&
&&&&&&&&&&&&&&& &value&*Dao&/value&
&&&&&&&&&&& &/list&&
&&&&&&& &/property&&
&&&&&&& &property name="interceptorNames"&&
&&&&&&&&&&& &list&&
&&&&&&&&&&&&&&& &value&transactionInterceptor&/value&&
&&&&&&&&&&& &/list&&
&&&&&&& &/property&&
&&& &/bean&&
&&& &!-- 配置DAO --&
&&& &bean id="userDao" class="com.bluesky.spring.dao.UserDaoImpl"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
第四种方式:使用tx标签配置的拦截器
&?xml version="1.0" encoding="UTF-8"?&
&beans xmlns="http://www.springframework.org/schema/beans"
&&& xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&&& 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-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/context
&&&&&&&&&& http://www.springframework.org/schema/context/spring-context-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&
&&& &context:annotation-config /&
&&& &context:component-scan base-package="com.bluesky"&/&
&&& &bean id="sessionFactory"&
&&&&&&&&&&& class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&&
&&&&&&& &property name="configLocation" value="classpath:hibernate.cfg.xml"&/&&
&&&&&&& &property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"&/&
&&& &/bean&&
&&& &!-- 定义事务管理器(声明式的事务) --&&
&&& &bean id="transactionManager"
&&&&&&& class="org.springframework.orm.hibernate3.HibernateTransactionManager"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
&&& &tx:advice id="txAdvice" transaction-manager="transactionManager"&
&&&&&&& &tx:attributes&
&&&&&&&&&&& &tx:method name="*" propagation="REQUIRED"&/&
&&&&&&& &/tx:attributes&
&&& &/tx:advice&
&&& &aop:config&
&&&&&&& &aop:pointcut id="interceptorPointCuts"
&&&&&&&&&&& expression="execution(* com.bluesky.spring.dao.*.*(..))"&/&
&&&&&&& &aop:advisor advice-ref="txAdvice"
&&&&&&&&&&& pointcut-ref="interceptorPointCuts"&/&&&&&&&&
&&& &/aop:config&&&&&&
第五种方式:全注解
&?xml version="1.0" encoding="UTF-8"?&
&beans xmlns="http://www.springframework.org/schema/beans"
&&& xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&&& 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-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/context
&&&&&&&&&& http://www.springframework.org/schema/context/spring-context-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
&&&&&&&&&& http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&
&&& &context:annotation-config /&
&&& &context:component-scan base-package="com.bluesky"&/&
&&& &tx:annotation-driven transaction-manager="transactionManager"/&
&&& &bean id="sessionFactory"&
&&&&&&&&&&& class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&&
&&&&&&& &property name="configLocation" value="classpath:hibernate.cfg.xml"&/&&
&&&&&&& &property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"&/&
&&& &/bean&&
&&& &!-- 定义事务管理器(声明式的事务) --&&
&&& &bean id="transactionManager"
&&&&&&& class="org.springframework.orm.hibernate3.HibernateTransactionManager"&
&&&&&&& &property name="sessionFactory" ref="sessionFactory"&/&
&&& &/bean&
此时在DAO上需加上@Transactional注解,如下:
package com.bluesky.spring.
import java.util.L
import org.hibernate.SessionF
import org.springframework.beans.factory.annotation.A
import org.springframework.orm.hibernate3.support.HibernateDaoS
import org.
import com.bluesky.spring.domain.U
@Transactional
@Component("userDao")
public&class UserDaoImpl extends HibernateDaoSupport implements UserDao {
&&& public List&User& listUsers() {
&&&&&&& return&this.getSession().createQuery("from User").list();
阅读(263418)
&re: Spring事务配置的五种方式
请问第一个图是拿什么软件画的?&&&&&&
&re: Spring事务配置的五种方式
@heyangMindjet7.0,呵呵&&&&&&
&re: Spring事务配置的五种方式
用什么画的图啊?&&&&&&
&re: Spring事务配置的五种方式
@The Matrix请问能否再简要说说这几种方式各自的好处与不足,或适用的场景?谢谢&&&&&&
&re: Spring事务配置的五种方式
@雨奏第一种方式与第二种方式是类似的,在所有方式中,第一种方式所需写的配置文件最多。在Spring2.0时,一般都采用方式三,主要带来的好处就是配置文件的量变小。在Spring2.5时,可以采用方式五,这样基本可以做到0配置了:)&&&&&&
&re: Spring事务配置的五种方式
@The Matrix谢谢你的耐心解答。目前我倒是常用第4种方式&&&&&&
&re: Spring事务配置的五种方式
我想请教一个疑问:
假如我采用了第四种配置方式,然后我在某一个类*.dao.Test中调用了两个对象,诸如*.dao.UserDao和*.dao.RoleDao,那么此时的事物拦截机制是怎样?
如:
Test中有方法:
execute(){
userDao.insert();
roleDao.insert();
}
那么这个execute是否算一个事务?
望解答。多谢。&&&&&&
&re: Spring事务配置的五种方式
@Woden如果事务拦截机制对Test类中的execute方法生效,那么两个dao的insert方法是在一个事务,否则两个dao的insert方法就不在一个事务中。&&&&&&
&re: Spring事务配置的五种方式
不错的文章,收藏了。有一个问题想请教你:
第五种方式中,如果UserDaoImpl类中有很多方法,但不是全部方法都加上事务,那应怎么处理?&&&&&&
&re: Spring事务配置的五种方式
@心梦帆影没有测试,但我想是否可以只在方法上加@Transactional注解最近太忙了,要同时面临好几件事情,兄弟有测试结果,可以告知我一下,呵呵&&&&&&
&re: Spring事务配置的五种方式[未登录]
收藏了,不错,慢慢研究&&&&&&
&re: Spring事务配置的五种方式
收藏~ 慢慢消化~&&&&&&
&re: Spring事务配置的五种方式
如果使用了多个数据源的话,@Transactional到底哪个数据源的事务?&&&&&&
&re: Spring事务配置的五种方式
辛苦楼主。很有奉献精神,学习!!&&&&&&
&re: Spring事务配置的五种方式
非常感谢,来得及时,&&&&&&
&re: Spring事务配置的五种方式
文章很好,感谢楼主奉献精神&&&&&&
&re: Spring事务配置的五种方式[未登录]
确实写得很不错&&&&&&
&re: Spring事务配置的五种方式
bz的文章写的不错,请问可以转载吗? 会写转载地址的&&&&&&
&re: Spring事务配置的五种方式[未登录]
很详细,以前只知其然,不知其所以然,现在明白点了,以后再细看&&&&&&
&re: Spring事务配置的五种方式
谢谢楼主的分享。&&&&&&
&re: Spring事务配置的五种方式
觉得第三、四种比较方便,好用&&&&&&
&re: Spring事务配置的五种方式
我一般用第五种,借问一下楼主,我在使用第五种的时候报错了,错误是:
Exception in thread &main& org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'personDao' defined in file [E:\workspace\TestSpring\bin\com\unmi\dao\impl\PersonDaoImpl.class]: Invocation o nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
不知道是什么原因,要如何解决呢?&&&&&&
&re: Spring事务配置的五种方式[未登录]
很好的总结,感谢楼主!&&&&&&
&re: Spring事务配置的五种方式
我们现在用的是第五种方式吗?
第五种的第一部分
&!-- 定义事务管理器(声明式的事务) --&
是需要自己写的吗?&&&&&&
&re: Spring事务配置的五种方式
使用第五种方式在spring3.X hibernate3.X下@Transactional不能工作,是jar包冲突还是?(springsource 文档貌似有说过不能保证@Transactional都有效)&&&&&&
&re: Spring事务配置的五种方式
@heyang
用铅笔画的&&&&&&
&re: Spring事务配置的五种方式
好文章,学习了,&&&&&&
&re: Spring事务配置的五种方式
说的好,不如做的好!&&&&&&
&re: Spring事务配置的五种方式
bluesky?莫非是hx的&&&&&&
&re: Spring事务配置的五种方式
学习啦&&&&&&
&re: Spring事务配置的五种方式
我听着陈瑞的歌曲,看完上面文章,很高效率的看完了。
人要有点坚持啊,不能三心二意啊。
咎由自取-----日本大地震的真正原因!!!
&&&&&&
&re: Spring事务配置的五种方式
最好的配置当然是第4种tx配置。&&&&&&
&re: Spring事务配置的五种方式
android学习群:,flex群:
&&&&&&
&re: Spring事务配置的五种方式
&re: Spring事务配置的五种方式
请问第五种方式你确定你的可以么?我的怎么不行呢!我也是按照你的方法配置的啊!?&&&&&&
&re: Spring事务配置的五种方式
@joynet007
还要加上这句话。
&tx:annotation-driven transaction-manager=&transactionManager& /&&&&&&&
&re: Spring事务配置的五种方式[未登录]
你怎么把@Transactional
写在类上了?不是写在方法上吗?&&&&&&
&re: Spring事务配置的五种方式[未登录]
正在学习,很好总结 tks LZ
&&&&&&
&re: Spring事务配置的五种方式
我用的你写的第二种
可以麻烦你看看我的这个错误么?
这是地址问题都在里面了:
感激不尽哦!&&&&&&
&re: Spring事务配置的五种方式
真不错。。。。感谢。。。&&&&&&
&re: Spring事务配置的五种方式
@xiaohaiben007
牛人,非常感谢&&&&&&
&re: Spring事务配置的五种方式
牛人,非常感谢 &&&&&&
&re: Spring事务配置的五种方式[未登录]
&re: Spring事务配置的五种方式[未登录]
犀利,困惑我2天的东西,被你点通了&&&&&&
&re: Spring事务配置的五种方式
&re: Spring事务配置的第五种方式
第五种方式
我试了试 在3.0下面,不德行&&&&&&
&re: Spring事务配置的五种方式
@Transactional加在方法上就可以给某个方法加上事物了,比如增删改,加在service类上就是给所有方法都加上事物了&&&&&&
&re: Spring事务配置的五种方式
很不错,顶一个&&&&&&
&re: Spring事务配置的五种方式
强大&&&&&&
&re: Spring事务配置的五种方式
@heyang思维导图&&&&&&
&re: Spring事务配置的五种方式
肯定是用第五种啦 呵呵 不过只是基于java5才能用&&&&&&
&re: Spring事务配置的五种方式
你这个有jdbctemplate的示例程序?&&&&&&
&re: Spring事务配置的五种方式
楼主 你的第二种配置方式 &!-- 配置DAO --&
&bean id=&userDaoTarget& class=&com.bluesky.spring.dao.UserDaoImpl&&
&property name=&sessionFactory& ref=&sessionFactory& /&
&bean id=&userDao& parent=&transactionBase& &
&property name=&target& ref=&userDaoTarget& /&
&/bean& 能否提供一下spring jdbctemplate方式配置呢&&&&&&
&re: Spring事务配置的五种方式
还一个问题比较疑虑 userDao之中的name是自己可以随意命名的吧 你看我的jdbc配置如下 &bean id=&taskServer& parent=&transactionBase&
class=&com.abc.DataGatherTaskServer&&
&property name=&taskDao& &
&ref bean=&TaskDao& /&
&/property&
&/bean& 其中transactionBase 在启动tomcat会出错!nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'transactionManager' of bean class [com.abc.TaskServer]: Bean property 'transactionManager' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 此处错误是我在dao之中为get,set 'transactionManager' ?&&&&&&
&re: Spring事务配置的五种方式
@jianxia612针对第二种已经找到设置方法:&bean id=&taskServer& parent=&transactionBase& &
&property name=&target&&
&bean class=&com.abc.server.TaskServer&&
&property name=&taskDao& ref=&taskDao&/&
&/property&
&/bean&&&&&&&
&re: Spring事务配置的五种方式
挺细致的&&&&&&
&re: Spring事务配置的五种方式
很有用,非常感谢!&&&&&&
&re: Spring事务配置的五种方式
博主讲的意思是对的,但是事务一般是不能加到dao层的,应该加到service层,还有就是,博主没有写出来,rollbackfor与noRollbackfor等等&&&&&&
&re: Spring事务配置的五种方式
楼主,请问楼主,个人感觉第四种方式只要是把规则配置好了,其他需要使用事务的类,方法,就不用做多余的配置了,第五种方法是全注解,每个需要做事务处理的方法都需要手动配置注解,是不是第四种方法比第五种方法更好?&&&&&&
&re: Spring事务配置的五种方式
讲解的很好,非常感谢!!&&&&&&
&re: Spring事务配置的五种方式
非常感谢分享&&&&&&
&re: Spring事务配置的五种方式[未登录]
想在业务层service中做个事务,一个service调用多个dao时,如果有一个dao出错,其他全部回滚。采用第三种方法可以实现吗,要怎么配置?&&&&&&
&re: Spring事务配置的五种方式[未登录]
&re: Spring事务配置的五种方式[未登录]
&re: Spring事务配置的五种方式[未登录]
我使用的是第四种方式,没有用hibernate,其他配置的都一样,事务还是没控制住,请问这可能是什么原因呢?&&&&&&
&re: Spring事务配置的五种方式
@guoguo很有可能是其他xml文件干扰了。&&&&&&
&re: Spring事务配置的五种方式
第一种方式中&property name=&proxyInterfaces& value=&com.bluesky.spring.dao.GeneratorDao& /&GeneratorDao是接口吗?你是不是没有service层,直接在dao层加的事务?&&&&&&
&re: Spring事务配置的五种方式[未登录]
确实是可以在方法上加这个注解的@The Matrix&&&&&&
&re: Spring事务配置的五种方式
@周龙我也是用地五种配置,事物也不起作用,请赐教&&&&&&
&re: Spring事务配置的五种方式
@sunyi我都是按照上面的配置做的配置,但事物不起作用&&&&&&
&re: Spring事务配置的五种方式
@落叶飞星还需要加事务注解支持&tx:annotation-driven transaction-manager=&transactionManager& /&&&&&&&
&re: Spring事务配置的五种方式
ssss&&&&&&
&re: Spring事务配置的五种方式
得分析下这几种方式的工作原理和优缺点啊。&&&&&&
&re: Spring事务配置的五种方式
@The Matrix
可以的&&&&&&
&re: Spring事务配置的五种方式
spring代码下载:&&&&&&
&re: Spring事务配置的五种方式
不错的文章!&&&&&&
&re: Spring事务配置的五种方式
怎么收藏啊&&&&&&
&re: Spring事务配置的五种方式
@Terry遇到同样的问题,有没有解决?&&&&&&
&re: Spring事务配置的五种方式
楼上说的按照上面的配置做的配置,但事物不起作用,原因如下:&bean id=&dataSource& class=&mons.dbcp2.BasicDataSource& destroy-method=&close&&
&property name=&driverClassName& value=&com.mysql.jdbc.Driver&/&
&property name=&url& value=&jdbc:mysql://localhost:3306/db?characterEncoding=utf8&/&
&property name=&defaultAutoCommit& value=&false&/& &/bean&要设置dataSource 的自动提交为false,让spring 去管理提交,自动提交默认是true&&&&&&
&re: Spring事务配置的五种方式
楼主你好,能不能分享一个aop事务管理的小项目,包括写不成功回滚异常的,谢谢了。&&&&&&
&re: Spring事务配置的五种方式
deqw&&&&&&
&re: Spring事务配置的五种方式
多个更新语句执行时,有一个没有更新成功,但是不报错,我如何手动控制让其他的回滚呢。&&&&&&
&re: Spring事务配置的五种方式
connection is closed 该怎么改?&&&&&&
&re: Spring事务配置的五种方式[未登录]
第四种方法,应该在service上加事务吧,不应该加在dao层吧&&&&&&
阅读排行榜
评论排行榜

参考资料

 

随机推荐