求大神指教,为甚么transactional注解无效

@Override
@Transactional
public void update(UserParam userParam) {
BeanValidator.check(userParam);
if (checkExist(userParam.getUsername())) {
throw new ParamException("当前用户名已存在,请更换用户名");
}
if (!checkReg(userParam.getTelephone(), 1)) {
throw new ParamException("电话格式错误");
}
if (checkExist(userParam.getTelephone())) {
throw new ParamException("电话已被占用");
}
if (checkExist(userParam.getEmail())) {
throw new ParamException("邮箱已被占用");
}
SysUser before = sysUserMapper.selectByPrimaryKey(userParam.getUserId());
Preconditions.checkNotNull(before, "待更新的用户不存在");
SysUser after = SysUser.builder().userId(userParam.getUserId()).username(userParam.getUsername()).telephone(userParam.getTelephone()).
email(userParam.getEmail()).deptId(userParam.getDeptId()).status(userParam.getStatus()).
remark(userParam.getRemark()).build();
after.setOperatorTime(new Date());
// 为什么不回滚?
sysUserMapper.updateByPrimaryKeySelective(after);
int a = 9/0;
//iSysLogService.saveUserLog(before, after);
}
如下调用:
/**
* 更新用户信息
@param  userParam
* @return
*/
@RequestMapping("/update.json")
@ResponseBody
public JsonData updateUser(UserParam userParam) {
sysUserService.update(userParam);
return JsonData.success();
}


配置信息:




你可能感兴趣的:(Java)