attempted to return null from a method with a primitive return type

简介: attempted to return null from a method with a primitive return type

 问题:springboot+mybatisplus 项目,查询的时候报:

attempted to return null from a method with a primitive return type。

问题分析:后台sql未查询出数据,导致返回的内容与接口中的入参类型不一致,报错。

解决方案:修改相应接口的返回类型为包装类。

mybatis的查询无结果时的返回值报错问题_mybatis进行遍历 参数没有值就报错_知凡的博客-CSDN博客


目录
相关文章
|
11月前
|
JavaScript API
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
198 0
|
SQL Java 数据库连接
org.apache.ibatis.binding.BindingException: Mapper method 'attempted to return null from a method wi...
org.apache.ibatis.binding.BindingException: Mapper method 'attempted to return null from a method wi...
177 0
org.apache.ibatis.binding.BindingException: Mapper method '...' attempted to return null from a m...
FIX: org.apache.ibatis.binding.BindingException: Mapper method 'com.alibaba.swork.
2133 0
delete attempted to return null from a method with a primitive return type (int)
今天被自己给蠢死了 今天在代码中遇到这个错误, 百度翻译一下:映射方法,从一org.system.mapper.child.chmorganizationexaminationmapper.delete返回零作为一个原始的方法的返回类型(int)。
2890 0
is present but cannot be translated into a null value due to being declared as a primitive type
解决办法:把基本类型改为对象,譬如此处将pageId的类型由int 改为Integer 2016-10-19 19:36:11.275 DEBUG [http-nio-9999-exec-2][org.
2683 0
|
4月前
|
SQL 关系型数据库 MySQL
实时计算 Flink版产品使用合集之从MySQL同步数据到Doris时,历史数据时间字段显示为null,而增量数据部分的时间类型字段正常显示的原因是什么
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStreamAPI、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
1月前
|
SQL 关系型数据库 MySQL
在 MySQL 中使用 IS NULL
【8月更文挑战第12天】
583 0
在 MySQL 中使用 IS NULL
|
4月前
|
SQL 关系型数据库 MySQL
python在mysql中插入或者更新null空值
这段代码是Python操作MySQL数据库的示例。它执行SQL查询从表`a_kuakao_school`中选取`id`,`university_id`和`grade`,当`university_id`大于0时按升序排列。然后遍历结果,根据`row[4]`的值决定`grade`是否为`NULL`。若不为空,`grade`被格式化为字符串;否则,设为`NULL`。接着构造UPDATE语句更新`university`表中对应`id`的`grade`值,并提交事务。重要的是,字符串`NULL`不应加引号,否则更新会失败。
124 2