attempted to return null from a method with a primitive return type (int)异常的解决
2017-12-19 11:59
726 查看
项目启动正常,执行添加时数据也能保存到数据库中,但报这个异常,org.apache.ibatis.binding.BindingException: Mapper method 'com.krk.gzytj.machineregister.mapper.MachineRgisterMapper.addMachineRegister
attempted to return null from a method with a primitive return type (int).,原来是xxMapper.xml文件里写错了:
<select id="addMachineRegister" parameterType="MachineRgister">
insert into MachineRgister(sAreaCode,sHospitalCode,sSupplierCode,sMachineCode,sModel,dDistributeDate,sPUserCode,sPName,iFlag,dUpdateTime)values(#{sAreaCode},#{sHospitalCode},#{sSupplierCode},#{sMachineCode},#{sModel},#{dDistributeDate},#{sPUserCode},#{sPName},#{iFlag},#{dUpdateTime})
</select>
只需把select 替换成insert即可,因为这是执行insert的sql,使用<select id="">当然不合适了。
attempted to return null from a method with a primitive return type (int).,原来是xxMapper.xml文件里写错了:
<select id="addMachineRegister" parameterType="MachineRgister">
insert into MachineRgister(sAreaCode,sHospitalCode,sSupplierCode,sMachineCode,sModel,dDistributeDate,sPUserCode,sPName,iFlag,dUpdateTime)values(#{sAreaCode},#{sHospitalCode},#{sSupplierCode},#{sMachineCode},#{sModel},#{dDistributeDate},#{sPUserCode},#{sPName},#{iFlag},#{dUpdateTime})
</select>
只需把select 替换成insert即可,因为这是执行insert的sql,使用<select id="">当然不合适了。
相关文章推荐
- 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).报错解决方案
- 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).
- [置顶] 【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).
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
- Null value was assigned to a property of primitive type setter of"原因及解决方
- 异常:Null value was assigned to a property of primitive type setter of···
- 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
- Android异常 NullPointerException: Attempt to invoke virtual method int java.lang.Integer.intValue()
- The method contains(CharSequence) from the type String refers to the missing type CharSequence错误解决方法
- Spring之AOP奇葩报错:Null return value from advice does not match primitive return type for
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
- Null value was assigned to a property of primitive type setter问题分析与解决
- BUG6:Cannot return a value from a method with void result type 返回值错误
- Null value was assigned to a property of primitive type setter of"原因及解决方
- Null value was assigned to a property of primitive type setter ,hibernate int型数据无法读取 hiberante读int