zoukankan      html  css  js  c++  java
  • Spring之配置事务

    <!-- 配置事务管理器 (定义属性sessionFactory)-->

    <bean id="transationManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager">

    <property name="sessionFactory" ref="sessionFactory"/>

    </bean>

     

    <!-- 配置事务传播性(定义属性transaction-manager) -->

    <tx:advice id="useradvice" transaction-manager="transationManger">

    <tx:attributes>

    <tx:method name="add*" propagation="REQUIRED"/>

    <tx:method name="update*" propagation="REQUIRED"/>

    <tx:method name="delete*" propagation="REQUIRED"/>    

    <tx:method name="*" propagation="NOT_SUPPORTED"/>

    </tx:attributes>

    </tx:advice>

     

    <!-- 将事务使用aop切入到指定位置(定义属性advice-ref,pointcut-ref) -->

    <aop:config>

    <!-- 配置切入点 -->

    <aop:pointcut expression="execution(* com.March.dao.impl.*.*(..))" id="userpointcut"/>

    <aop:advisor advice-ref="useradvice" pointcut-ref="userpointcut"/>

    </aop:config>

  • 相关阅读:
    使用canvas技术在网页上绘制鲜花
    java连接Access数据库
    L2-009. 抢红包
    L2-008. 最长对称子串
    L1-032. Left-pad
    L1-016. 查验身份证
    L1-005. 考试座位号
    L1-030. 一帮一
    L1-023. 输出GPLT
    L1-028. 判断素数
  • 原文地址:https://www.cnblogs.com/wshan/p/2867072.html
Copyright © 2011-2022 走看看