关闭

声明式事务2.0

285人阅读 评论(0) 收藏 举报

author:何桂坤

<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"

xmlns:p="http://www.springframework.org/schema/p"
 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/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-

2.5.xsd">
----------------------------------------事务管理2.0------------------------------------------   
 <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory"></property>
 </bean>

 <aop:config>
  <aop:pointcut id="bizMethods" expression="execution(* biz.*.*(..))" />
  <!-- 织入 -->
  <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
 </aop:config>

 <tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="do*" propagation="REQUIRED" />
   <tx:method name="delete*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED" />
   <tx:method name="merge*" propagation="REQUIRED" />
   <tx:method name="*" propagation="NOT_SUPPORTED" />
  </tx:attributes>
 </tx:advice>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:21956次
    • 积分:200
    • 等级:
    • 排名:千里之外
    • 原创:43篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档