mybatis 返回主鍵出錯 P…

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.解決辦法
修改前:
修改後:
由於插入操作參數類型是一個對象,但是返回主鍵是一個值,就會造成參數類型不匹配。
修改後利用對象調用其屬性。最終傳入的參數類型還是一個對象。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章