关于attempted to return null from a method with a primitive return type (int).报错解决方案
2017-11-16 18:45
1056 查看
使用mybatis返回int类型时
项目总是报错
解决方案:(当查询出来为空时,给赋值一个默认值:MySQL使用函数ifnull())
<select id="queryPerfTarget" resultType="java.lang.Integer" > SELECT sum(perf_target) from subject </select>
项目总是报错
org.apache.ibatis.binding.BindingException: Mapper method 'queryPerfTarget' (interface com.****.workbench.subject.dao.SubjectMapper) attempted to return null from a method with a primitive return type (int).
解决方案:(当查询出来为空时,给赋值一个默认值:MySQL使用函数ifnull())
<select id="queryPerfTarget" resultType="java.lang.Integer" > SELECT IFNULL(sum(perf_target),0) from subject </select>
相关文章推荐
- delete 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)异常的解决
- 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)
- [置顶] 【java】Mybatis返回int类型为空时报错 attempted to return null from a method with a primitive return type (int)
- MyBatis提示getFundBonus attempted to return null from a method with a primitive return type (double)
- mybatis返回int类型报错 return null from a method with a primitive return type (int).
- 关于Hibernate中的int和float数据及Null value was assigned to a property of primitive type setter of
- 关于Attempt to invoke virtual method 'HSSFCell.getCellType(int)'' on a null object reference
- aop.AopInvocationException: null return value from advice does not match primitive return type for
- 关于 Type mismatch: cannot convert from Integer to int
- BUG6:Cannot return a value from a method with void result type 返回值错误
- 异常处理:Null value was assigned to a property of primitive type setter of"原因及解决方案
- MyBatis Error:BindingException Mapper method attempted to return null
- Null value was assigned to a property of primitive type setter ,hibernate int型数据无法读取 hiberante读int
- Cast from pointer to smaller type 'int' loses information解决方案
- Spring之AOP奇葩报错:Null return value from advice does not match primitive return type for
- Null value was assigned to a property of primitive type setter of 的原因与解决方案
- Cast from pointer to smaller type 'int' loses information
- hibernate Null value was assigned to a property of primitive type setter