`

Oracle Cannot convert value of type [null] to required type [int] for property

 
阅读更多

在spring集成oracle的项目中遇到如下问题 ,查询结果是准确的,但是在对象转换的时候出现如下错误,程序没有错误,主要是那个字段是int类型的,然后数据库中该字段对应的值为null就报了该错误,如果使用Integer不会报错,同样其他基本类型是一样的:

 

Cannot convert value of type [null] to required type [int] for property

 

原因:数据库中的该字段需要有int类型的值,但是值为null为出现该错误

解决办法:将数据库中的空值替换或者使用Integer等对象类型

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics