我在用spring配置声明式事务时 用<tx:advice>里面没有属性 自己往里加时 有错误 
配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  - Middle tier application context definition for the image database.
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"><bean name="sessionFactory" class="hibernate.HibernateSessionFactory"/><bean name="transaction" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice>
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="update" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="send*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="select*" read-only="true"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice><aop:config>
<aop:pointcut id="persionImpl" expression="execute(* persionImpl.PersionImpl.*(..))"/><aop:advisor id="advice" advice-ref="?" pointcut-ref="persionImpl"/>
</aop:config><bean name="persionImpl" class="persionImpl.PersionImpl"/></beans>希望哪位高手来帮我解决一下?

解决方案 »

  1.   

    给你一个我这边的例子:
    <!-- 配置事务的传播特性 -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="add*" propagation="REQUIRED"/>
    <tx:method name="delete*" propagation="REQUIRED"/>
    <tx:method name="modify*" propagation="REQUIRED"/>
    <tx:method name="*" read-only="true"/>
    </tx:attributes>
    </tx:advice>

    <!-- 那些类的哪些方法参与事务 -->
    <aop:config>
    <aop:advisor pointcut="execution(* com.oa.manager.*.*(..))" advice-ref="txAdvice"/>
    </aop:config>注意红色文字的写法,寻找执行切入点。
      

  2.   

    <tx:advice id="txAdvice" transaction-manager="transactionManager">加了id属性厚报错 只能写成
    <tx:advice>
    是什么原因啊 缺包吗? 还是 配置文件头有问题?