<!–声明事务–>
<bean id=”txManager”>
<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=”has*” read-only=”true”/>
<tx:method name=”add*” propagation=”REQUIRED” />
<tx:method name=”alter*” propagation=”REQUIRED” />
<tx:method name=”upd*” propagation=”REQUIRED” />
<tx:method name=”del*” propagation=”REQUIRED” />
<tx:method name=”exec*” propagation=”REQUIRED” />
</tx:attributes>
</tx:advice>
<!– 切入接口所在的包 –>
<aop:config>
<aop:pointcut id=”serviceOperation” expression=”execution(public * org.bgi.*.service.*.*(..))” />
<aop:advisor advice-ref=”txAdvice” pointcut-ref=”serviceOperation” />
</aop:config>

更多:http://www.javaxxz.com/thread-67427-1-1.html

posted on 2013-01-15 12:47  Java学习者  阅读(857)  评论(0)    收藏  举报