使用spring Data JPA更新数据时,一直报以下错误
could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
由于后台能够成功返回数据,一直以为整个项目已经执行完毕
出现问题的原因 : 执行save方法时有错误但是会接着执行,直到返回时才报错
遇到此类问题:
- 检查接口使用的方法是否正确;
- @Transactional注解
- 检查数据库设计是否有问题:包括主键的自增长,各个字段的长度是否合理。