mybatis 返回主键出错 P…

来源:互联网 发布:如何下载喀秋莎软件 编辑:程序博客网 时间:2024/06/06 09:18
1.错误信息
三月 06, 2017 5:04:34 下午org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [springMvc] in context withpath [/lst_platform] threw exception [Request processing failed;nested exception is org.mybatis.spring.MyBatisSystemException:nested exception is org.apache.ibatis.executor.ExecutorException:Error getting generated key or setting result to parameter object.Cause: org.apache.ibatis.binding.BindingException: Parameter 'ID'not found. Available parameters are [EquipmentManagement, param1]]with root cause
org.apache.ibatis.binding.BindingException: Parameter 'ID' notfound. Available parameters are [EquipmentManagement, param1]
atorg.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.
atorg.apache.ibatis.reflection.wrapper.MapWrapper.getSetterType(MapWrapper.
atorg.apache.ibatis.reflection.MetaObject.getSetterType(MetaObject.


2.解决办法
修改前:
修改后:
由于插入操作参数类型是一个对象,但是返回主键是一个值,就会造成参数类型不匹配。
修改后利用对象调用其属性。最终传入的参数类型还是一个对象。
原创粉丝点击