Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
2017-08-16 15:21
549 查看
项目运行成功,但是点击什么栏目或者栏目中名称带#出现500错误,后台报错代码是:
Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive
type.
这段代码的主要意思是:
你定义的字段,我这里就是topicId这个字段定义成了int类型,但是在这个参数定义不是非必须的(也就是你的某个方法定义了这个参数,但是这个参数是非必须的,系统会自动给这个字段赋值为null值,但是int类型不能接收null值)
解决方法是:将int类型改成Integer封装类型.
注意:到这里我想你的上面报错信息应该就得以解决了,但是如果接下来你出现了NullpointException
出现这种情况的原因是你在该方法里面又调用了一个方法,并且被你调用的这个方法里面用到了你的这个字段参数,此时的解决方法就是显而易见了,把参数类型转成相应类型就OK了。
Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive
type.
这段代码的主要意思是:
你定义的字段,我这里就是topicId这个字段定义成了int类型,但是在这个参数定义不是非必须的(也就是你的某个方法定义了这个参数,但是这个参数是非必须的,系统会自动给这个字段赋值为null值,但是int类型不能接收null值)
解决方法是:将int类型改成Integer封装类型.
注意:到这里我想你的上面报错信息应该就得以解决了,但是如果接下来你出现了NullpointException
出现这种情况的原因是你在该方法里面又调用了一个方法,并且被你调用的这个方法里面用到了你的这个字段参数,此时的解决方法就是显而易见了,把参数类型转成相应类型就OK了。
相关文章推荐
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'rip' is present but cannot be translated into a null value due to being decl
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'folderId' is not present but cannot be translated into a null value due to b
- Optional int parameter 'pageNumber' is present but cannot be translated into a null value due to bei
- Optional int parameter 'projectId' is present but cannot be translated into a null value due to bein
- is present but cannot be translated into a null value due to being declared as a primitive type
- java.lang.IllegalStateException: Optional int parameter 'pageSize' is present but cannot be translat
- java.lang.IllegalStateException: Optional int parameter 'studentid' is present but cannot be transla
- java.lang.IllegalStateException: Optional long parameter 'adminId' is present but cannot be translat
- float和Float的问题,错误原因:cannot be translated into a null value
- LINQ to Entities does not recognize the method , and this method cannot be translated into a store expression 解决办法
- hmset命令报错 value sent to redis cannot be null
- keil(MDK)中出现error: #513: a value of type "int" cannot be assigned to an entity of type "char *",即函数返
- SilverLight TroubleShoot: value cannot be null parameter name: binding
- asp.net 异常:Message="Value cannot be null.\r\nParameter name: g"
- typescript: error TS2693: 'Promise' only refers to a type, but is being used as a value here
- 报错: LINQ to Entities does not recognize the method...and this method cannot be translated into a sto