hibernate不能更新(crud操作)

1、在spring的事务管理中没有配置service的方法 
    <!-- 4.txAdvice-->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="save*" propagation="REQUIRED"/>
            <tx:method name="insert*" propagation="REQUIRED"/>
            <tx:method name="update*" propagation="REQUIRED"/>
            <tx:method name="delete*" propagation="REQUIRED"/>
            <tx:method name="add*" propagation="REQUIRED" /> 
            <tx:method name="to*" propagation="REQUIRED" />
            <tx:method name="change*" propagation="REQUIRED" />
            <tx:method name="get*" read-only="true"/>
            <tx:method name="*"  propagation="REQUIRED"/>
        </tx:attributes>
    </tx:advice>
    <!-- 5.aop-->
    <aop:config >
        <aop:pointcut id="pointcut" expression="execution(public * my.service.*.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="pointcut" />
    </aop:config>

2、  <!-- 使aspectJ注解起作用:自动为匹配的类生成代理对象 -->
    <!-- shiro安全框架产生代理子类的方式,使用cglib方式  -->
    <aop:aspectj-autoproxy proxy-target-class="true" />

猜你喜欢

转载自blog.csdn.net/civilizationv/article/details/80674313