ssh事务配置

<!-- 配置业务层 -->
    <bean id="employeeService" class="cn.bdqn.jboa.service.impl.EmployeeServiceImpl">
        <property name="employeeDao" ref="employeeDao"></property>
    </bean>
    <bean id="claimVoucherService" class="cn.bdqn.jboa.service.impl.ClaimVoucherServiceImpl">
        <property name="claimVoucherDao" ref="claimVoucherDao" />
        <property name="claimVoucherDetailDao" ref="claimVoucherDetailDao" />
    </bean>
    
    <!-- 定义事务管理器 -->
    <bean id="txManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:advice id="txAdvice" transaction-manager="txManager">
        <tx:attributes>
            <tx:method name="find*" read-only="true" />
            <tx:method name="search*" read-only="true" />
            <tx:method name="query*" read-only="true" />
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="del*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="do*" propagation="REQUIRED" />
            <tx:method name="*" propagation="REQUIRED" read-only="true" />
        </tx:attributes>
    </tx:advice>
    <aop:config>
        <!-- 定义切入点 -->
        <aop:pointcut id="serviceMethod"
            expression="execution(* cn.bdqn.jboa.service.*.*(..))" />
        <!-- 将事务通知与切入点组合 -->
        <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod" />
    </aop:config>
原文地址:https://www.cnblogs.com/xuerong/p/4935013.html