TA的每日心情 | 开心 2021-12-13 21:45 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
|
- [/code]
- [code]<!-- 使用注解方式定义事务 --> <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" />
复制代码- [/code]
- [code]<!-- 配置事务管理器 --><bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /></bean>
复制代码
- <!-- 配置事务传播特性 -->
- <tx:advice id="transactionAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="save*" propagation="REQUIRED" />
- <tx:method name="delete*" propagation="REQUIRED" />
- <tx:method name="update*" propagation="REQUIRED" />
- <tx:method name="get*" read-only="true"/>
- <tx:method name="load*" read-only="true"/>
- <tx:method name="find*" read-only="true"/>
- <tx:method name="*" read-only="true"/>
- </tx:attributes>
- </tx:advice>
复制代码
- <!-- 配置哪些类的哪些方法参与事务 --> <aop:config> <aop:advisor pointcut="execution(* com.sdjz.eshop.service.*..*.*(..))" advice-ref="transactionAdvice" /> </aop:config>
复制代码
|
|