务必检查这个部分。上面这个写法就无法保存,下面的就可以保存。具体技术原因,可以网上搜一下掌握事务配置的具体含义。
1 <tx:advice id="txAdvice" transaction-manager="txManager"> 2 <tx:attributes> 3 <tx:method name="save*" propagation="REQUIRED" /> 4 <tx:method name="update*" propagation="REQUIRED" /> 5 <tx:method name="delete*" propagation="REQUIRED" /> 6 <tx:method name="login*" propagation="REQUIRED" /> 7 <tx:method name="*" read-only="true" /> 8 </tx:attributes> 9 </tx:advice>
1 <tx:advice id="txAdvice" transaction-manager="txManager"> 2 <tx:attributes> 3 <tx:method name="save*" propagation="REQUIRED" /> 4 <tx:method name="update*" propagation="REQUIRED" /> 5 <tx:method name="delete*" propagation="REQUIRED" /> 6 <tx:method name="login*" propagation="REQUIRED" /> 7 <tx:method name="executeUpdate*" propagation="REQUIRED" /> 8 <tx:method name="run" propagation="NOT_SUPPORTED" /> 9 <tx:method name="*" read-only="true" /> 10 </tx:attributes> 11 </tx:advice>