1.错误信息
三月 06, 2017 5:04:34 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [springMvc] in context with path [/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' not found. Available parameters are [EquipmentManagement, param1]
at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.
at org.apache.ibatis.reflection.wrapper.MapWrapper.getSetterType(MapWrapper.
at org.apache.ibatis.reflection.MetaObject.getSetterType(MetaObject.
2.解决办法
修改前:
修改后:
由于插入操作参数类型是一个对象,但是返回主键是一个值,就会造成参数类型不匹配。
修改后利用对象调用其属性。最终传入的参数类型还是一个对象。