今天很郁闷,就是这个spring 的事务 ,我使用 声明式事务处理
<tx:advice id="txadvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="add*" propagation="REQUIRED" rollback-for="java.sql.SQLException"/> <tx:method name="update*" propagation="REQUIRED" rollback-for="java.sql.SQLException"/> <tx:method name="delete*" propagation="REQUIRED" rollback-for="java.sql.SQLException"/> <tx:method name="get*" read-only="true"/> <tx:method name="save*" propagation="REQUIRED" rollback-for="java.sql.SQLException"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut id="unsteadyPointCut" expression="execution(* com.xyz.service.unsteady..*(..))" /> <aop:advisor advice-ref="txadvice" pointcut-ref="unsteadyPointCut"/> </aop:config>
通过xml的配置知道,我是对 包名为 com.xyz.service.unsteady下的类中的 add* , update* ,delete* , get* ,save* 等方法进行事务管理的,但是我新添加了一个类在这个包下 并且方法名也是这样匹配的。但是 就是不对我这类中的方法进行事务管理 ,导致我删除操作不行 。
在控制台上也打印了sql语句。就是不删除 。我认为是事务没有开启导致,而且在spring的配置文件里的提示也没有我这个方法有事务管理。这个怎么解决呢
望解答。