sql报错解决方案:attempted to return null from a method with a primitive return type (int)
问题现象
idea执行查询数量语句控制台报错:attempted to return null from a method with a primitive return type (int).
解决方案
1、检查当前查询语句是否查询结果为空,或者没数据;
2、检查dao/mapper
层接收该sql的出参对象是“int
”还是“Integer
”;
3、int
默认值是0
,Integer
是包装类对象默认值为null
,数据库查询结果为空的时候返回的是个null
,所以用“int
”接收会报错。
sql报错解决方案:attempted to return null from a method with a primitive return type (int)相关推荐
- 关于mybatis的报错 attempted to return null from a method with a primitive return type (int)
https://blog.csdn.net/kisscatforever/article/details/77801060 一.前言 在往常敲代码的时候没有留意过int和Integer的区 ...
- attempted to return null from a method with a primitive return type (int).
错误产生的场景 dao层接口如下 int getResourceDataNumsByTitle(String title); mapper.xml 中sql语句如下 <select id=&qu ...
- mapper method attempted to return null from a method with a primitive return type (int)
一.场景和背景 工具:mybatis + pgsql dao代码: int selectMaxAgeBySex(String sex); 查询性别是女生的最大年龄 sql: <select id ...
- error:attempted to return null from a method with a primitive return type (int)
1,起因 今天老大让改bug,说有个模块数据提交不了,让我看看...检查服务器发现这个报错..attempted to return null from a method with a primiti ...
- Mybatis-增删改查踩坑- attempted to return null from a method with a primitive return type (int).
错误 在编写插入数据时一直报如下错误: attempted to return null from a method with a primitive return type (int). 原来的代码 ...
- Mybatis中的attempted to return null from a method with a primitive return type (int).异常
错误截图: org.apache.ibatis.binding.BindingException: Mapper method 'com.shop_demo.dao.AdminDAO.getAdmin ...
- Mybatis:Mapper method attempted to return null from a method with a primitive return type (int)
Mybatis中 Mapper method attempted to return null from a method with a primitive return type (int)错误 本 ...
- Mybatis异常错误:Mapper method attempted to return null from a method with a primitive return type (int)
在mybatis搭建时出现错误:Mapper method attempted to return null from a method with a primitive return type (i ...
- insertRole attempted to return null from a method with a primitive return type
练习myBatis,向数据库插入一条数据,期望返回1,结果报错. 多次查找,结果是Mapper对应的xml文件中sql语句的节点写成select了,应该是insert
最新文章
- 新创建的Django项目Django administration用户名和密码配置
- hibernate的HQL查询语言总结
- Make it Divisible by 25 思维
- linux gz 解压缩
- python flask web开发 可视化开发_python web开发之——Flask入门教程
- 如何注释python中html,Python在HTML中提取带注释的代码,python,html,被
- mongodb sharding 试用(四)
- ab plc软件_【原创】AB上位机FactoryTalk View的使用教程(上)
- 带你掌握Redis数据类型:string和Hash
- 蓝牙通信-打开和关闭蓝牙设备
- 公司管理系列--最难挖的阿里,最好挖的百度;最难走的360,最易走的腾讯
- 如何修改pdf文件内容
- 关于Mac学习C语言通过vscode如何编译运行代码
- python超声检测成像仿真_- 深度体验树莓派3:实操用Python驱动超声测距模块
- 联通家庭宽带光猫DDNS设置
- Excel2013打印时怎么固定表头及表尾让打印后的每页都可以看得到
- 58同城自动登录。。分享给大家
- JAVA 通过属性名称 获取属性值、设置属性值
- python png 背景透明_去除白色背景得到透明背景png的示例代码
- 命令行发送邮件并修改发送人,避免自动邮件归置到垃圾邮件
热门文章
- 发送手机验证码,验证手机验证码,包括数据表的设计
- 被动语态和非谓语区别_动词的被动语态和非谓语动词-ed形式区别
- 百度网盘不限速下载每秒6兆左右之Proxyee Down3.x安装到使用
- 基于SONY ICX694的4通道成像组件设计与调试
- Gmail和Orkut邀请自助发送[共享]
- html canvas粒子线条组合动画背景特效
- Java学习日记:set集合(不多用)
- 论文阅读 6 | Bayesian Meta-Learning for the Few-Shot Setting via Deep Kernels
- B/S中的三层架构和MVC设计模型
- java从接口直接下载文件到本地