赞
踩
在Dubbo的@Service注解类中,要想实现事务管理,必须在@Service后面加上(interfaceClass = “实现的接口.class”)
例:
@Service(interfaceClass = ParaService.class) public class ParaServiceImpl implements ParaService { @Autowired private ParaMapper paraMapper; @Autowired private TemplateMapper templateMapper; @Transactional public void add(Para para) { //将模版的参数数量加一 Template template = templateMapper.selectByPrimaryKey(para.getTemplateId()); template.setParaNum(template.getParaNum() + 1); templateMapper.updateByPrimaryKey(template); paraMapper.insert(para); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。