1 报错信息
- Spring报错
org.springframework.dao,DataIntegrityVoilationException:Error attempting to get column 'xx' from result set
- 数据库报错
org.postgresql.util.PSQLException:Bad value for type int
2 错误原因
实体类属性定义为Integer,但数据库该字段类型为varchar
3 触发机制
本人所遇到的情况为:如果该数据库该字段为null时,进行查询操作会触发该报错.如果数据库该字段刚好有数字字符,则不会触发
4 解决方案
将该字段属性改为String即可解决问题
数据库技术:Postgresql报错及解决方案:Bad value for type int / DataIntegrityVoilationException地址:https://blog.csdn.net/java0506/article/details/110676067
需要了解更多数据库技术:Postgresql报错及解决方案:Bad value for type int / DataIntegrityVoilationException,都可以关注数据库技术分享栏目—计算机技术网(www.ctvol.com)!
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/dtteaching/631567.html