ITPub博客

首页 > 应用开发 > Java > 在Spring中配置Service层方法的事务

在Spring中配置Service层方法的事务

Java 作者:小梁124 时间:2014-09-24 16:01:24 0 删除 编辑

< 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.mfqyw.com/)


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29870867/viewspace-1279490/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-09-11

  • 博文量
    71
  • 访问量
    214129