Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
来源:互联网 发布:pymongo 查询数据 编辑:程序博客网 时间:2024/05/21 09:31
项目运行成功,但是点击什么栏目或者栏目中名称带#出现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了。
阅读全文
1 0
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- 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 '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
- java.lang.IllegalStateException: Optional int parameter 'pageSize' is present but cannot be translat
- java.lang.IllegalStateException: Optional int parameter 'currentSpecialIndex' is present but cannot
- float和Float的问题,错误原因:cannot be translated into a null value
- linq insert The null value cannot be assigned to a member with type System.Int64 which is a non-null
- 报错: LINQ to Entities does not recognize the method...and this method cannot be translated into a sto
- ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated ORA-01264: Unable to
- Dereferencing a __weak pointer is not allowed due to possible null value caused by race condition, a
- Required int[] parameter 'ids' is not present
- Default value for column cannot be changed to NULL
- elasticSearch之版本冲突处理
- KMP字符串匹配算法
- 20170816周末记账流水(2017-08-16 10:00)
- 命令
- WebService调用小记
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- 51Nod 2006:飞行员配对(二分图最大匹配,匈牙利算法)
- Junit中的@before 和 @beforeclass 有什么区别?
- 基于TensorFlow实现AutoEncoder
- jquery常用函数
- 全排列问题
- 学习记录(7)补
- ELK(九)ElasticSearch5.XELK(七)ElasticSearch搜索
- jq实现键盘延迟事件