下面是配置,求解答
如
public Student querySutdent(id){
Student stu = XXDao.getStudent(id);
stu.setSex("男");
return stu;
}
会将 stu的 sex 更新数据库里面
[code="java"]
<!-- Enable @Transactional support -->
tx:annotation-driven/
<!-- Enable @AspectJ support -->
<aop:aspectj-autoproxy/>
<!-- Activates scanning of @Autowired -->
<context:annotation-config/>
<!-- Activates scanning of @service -->
<context:component-scan base-package="com.chinadrtv.erp.tc;com.chinadrtv.erp.shipment;com.chinadrtv.erp.ic"/>
<tx:advice id="txAdvice">
<tx:attributes>
<!-- Read-only commented out to make things easier for end-users -->
<tx:method name="build*" read-only="true" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="get*" read-only="true" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="calculate*" read-only="true" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="*" propagation="REQUIRED" rollback-for="Throwable"/>
</tx:attributes>
</tx:advice>
<!-- =================================================================== -->
<!-- AOP: Configuration and Aspects -->
<!-- =================================================================== -->
<aop:config>
<aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* *..service.*Service.*(..))" order="0"/>
<aop:advisor id="auditLogTx" advice-ref="txAdvice" pointcut="execution(* *..aop.*Service.*(..))" order="1"/>
</aop:config>
[/code]