在做透支转账时,前台报500,提示:违反检查约束条件;
不知在哪里抛出或者声明异常,请大神指点
前台报错500,内容如下:
exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:
Error updating database. Cause: java.sql.SQLException: ORA-02290: 违反检查约束条件 (PEPE.SALARY)
The error may involve com.zrgk.ssm.dao.EmpDao.updateSal-Inline
The error occurred while setting parameters
SQL: update emp set salary=salary+? where empid=?
Cause: java.sql.SQLException: ORA-02290: 违反检查约束条件 (PEPE.SALARY)
; SQL []; ORA-02290: 违反检查约束条件 (PEPE.SALARY)
; nested exception is java.sql.SQLException: ORA-02290: 违反检查约束条件 (PEPE.SALARY)
service实现类代码如下:
(已做转账的声明式事务)
@Service
public class EmpServiceImpl implements EmpService {
@Autowired
private EmpDao ed;
@Override
@Transactional(readOnly=false,propagation=Propagation.REQUIRED)
public void zhuan(Integer ruid, Integer chuid, Double money) {
// TODO Auto-generated method stub
//先转入
ed.updateSal(new Emp(ruid,null, money));
//再转出
ed.updateSal(new Emp(chuid, null, -money));
}
}