首先的在最上面加上aop和tx 命名空间

首先的在最上面加上aop和tx   命名空间
<!-- 配置hibernate事务管理器 -->
<bean id="TransManger" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 配置事务特性 -->
<tx:advice id="Transtx" transaction-manager="TransManger">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="find*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 使用aop 注入 -->
<aop:config>
<aop:pointcut id="pService" expression="execution(* com.qdc.service.*.*.*(..))"/>
<aop:advisor advice-ref="Transtx" pointcut-ref="pService"/>
</aop:config>

posted on 2016-01-05 16:38  清晨雨露  阅读(724)  评论(0编辑  收藏  举报

导航