zoukankan      html  css  js  c++  java
  • 【原创】如何配置声明书事务

    <!-- 配置sessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
            <property name="configLocation">
                <value>classpath:hibernate.cfg.xml</value>
            </property>    
        </bean>           
        
        <!-- 配置事务管理器 -->
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory">
                <ref bean="sessionFactory"/>
            </property>    
        </bean>
        
        <!-- 配置事务的传播特性 -->
        <tx:advice id="txAdvice" transaction-manager="transactionManager">
            <tx:attributes>
                <tx:method name="add*" propagation="REQUIRED"/>
                <tx:method name="del*" propagation="REQUIRED"/>
                <tx:method name="modify*" propagation="REQUIRED"/>
                <tx:method name="*" read-only="true"/>
            </tx:attributes>
        </tx:advice>
        
        <!-- 那些类的哪些方法参与事务 -->
        <aop:config>
            <aop:pointcut id="allManagerMethod" expression="execution(* com.bjsxt.usermgr.manager.*.*(..))"/>
            <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
        </aop:config>
  • 相关阅读:
    [NOIP-P1125]逃亡的准备
    [NOIP-P1125]两个数差
    问题 B: [NOIP-P1125]飙车
    [NOIP-P1125]计算概率
    牛跳
    化学方程式
    c++第十七章-(内联函数)
    c++第十六章-(函数模板与类模板)
    《将博客搬至CSDN》
    cocoaPods安装与使用
  • 原文地址:https://www.cnblogs.com/zhangxsh/p/3575456.html
Copyright © 2011-2022 走看看