Spring以注解方式配置事物:
@Transactional(isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,readOnly=true)//类上配置的注解会对所有方法生效
public class AccountServiceImpl implements AccountService {
private AccountDao ad ;
private TransactionTemplate tt;
@Override
@Transactional(isolation=Isolation.REPEATABLE_READ,propagation=Propagation.REQUIRED,readOnly=false)//可以覆盖类上配置的注解
public void transfer(final Integer from,final Integer to,final Double money) {
}
}
扫描二维码关注公众号,回复:
3698356 查看本文章