首页 > 学院 > 开发设计 > 正文

事务管理

2019-11-14 23:56:54
字体:
来源:转载
供稿:网友
事务管理

一、添加cglib.jar

二、sPRing.xml中加入如下配置

<!-- 事务管理器 --><bean id="txManager"class="org.springframework.orm.hibernate4.HibernateTransactionManager"><!-- <property name="dataSource" ref="myDataSource"></property> --><property name="sessionFactory" ref="sessionFactory" /></bean><aop:config proxy-target-class="true"><aop:pointcut expression="execution(* com.arhat.service.impl.*.*(..))"id="txCut" /><aop:advisor advice-ref="txAdvice" pointcut-ref="txCut" /></aop:config><tx:advice id="txAdvice" transaction-manager="txManager"><!-- 事务的传播属性 --><tx:attributes><tx:method name="*" propagation="SUPPORTS" read-only="true" /><tx:method name="save*" propagation="REQUIRED"></tx:method><tx:method name="update*" propagation="REQUIRED"></tx:method><tx:method name="delete*" propagation="REQUIRED"></tx:method></tx:attributes></tx:advice>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表