org.apache.ibatis.binding.BindingException: Mapper method 'com... has an unsupported return type
来源:互联网 发布:apl原油库存最新数据 编辑:程序博客网 时间:2024/06/06 11:26
场景:
service中间调用dao层方法时,出现以下错误,但是sql执行修改数据成功,并没有回滚问题:
十月 31, 2017 2:53:39 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet [bigaoread] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Mapper method 'com.bigaoread.platform.dao.beautifulreader.v2.YzActivecontrolMapper.updateActiveId' has an unsupported return type: class com.bigaoread.platform.model.beautifulreader.v2.YzActivecontrol] with root causeorg.apache.ibatis.binding.BindingException: Mapper method 'com.bigaoread.platform.dao.beautifulreader.v2.YzActivecontrolMapper.updateActiveId' has an unsupported return type: class com.bigaoread.platform.model.beautifulreader.v2.YzActivecontrolat org.apache.ibatis.binding.MapperMethod.rowCountResult(MapperMethod.java:91)at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:54)at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)at com.sun.proxy.$Proxy41.updateActiveId(Unknown Source)
原因:这个是因为dao层的sql执行成功后,返回的类型出现问题。
代码:
service层:
public Map<String, Object> updateActiveId(String newActiveId, String oldActiveId) {Map<String, Object> resultMap = new HashMap<>();if(subscribeQrcodeService.isExistActiveId(Long.parseLong(newActiveId))) {resultMap.put("status", 1);return resultMap;}if(!(null == this.get(Long.parseLong(newActiveId)))) {resultMap.put("status", 1);return resultMap;}Map<String, Object> updateIdMap = new HashMap<>();updateIdMap.put("newActiveId", Long.parseLong(newActiveId));updateIdMap.put("oldActiveId", Long.parseLong(oldActiveId));yzActivecontrolMapper.updateActiveId(updateIdMap);resultMap.put("status", 0);return resultMap;}dao层:
YzActivecontrol updateActiveId(Map<String, Object> updateIdMap);
mapper.xml:
<update id="updateActiveId" parameterType="Map"> UPDATE <include refid="tableName"/> SET id = #{newActiveId} WHERE id = #{oldActiveId} </update>
解决:
mapper文件中的update,delete,insert语句是不需要设置返回类型的,它们都是默认返回一个int,所以应该修改dao层接口的方法:
Integer updateActiveId(Map<String, Object> updateIdMap);或者
void updateActiveId(Map<String, Object> updateIdMap);
阅读全文
0 0
- org.apache.ibatis.binding.BindingException: Mapper method 'com... has an unsupported return type
- org.apache.ibatis.binding.BindingException: Mapper method 'com.zbiti.alarm.dao.AlarmDao.queryTest at
- Exception in thread "main" org.apache.ibatis.binding.BindingException: Mapper method 'com.demo.DAO.B
- org.apache.ibatis.binding.BindingException: Type interface dxm.com.mapper.UserMapper is not known to
- Mapper method 'dao.xxx' has an unsupported return type
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.png.mapper.User
- org.apache.ibatis.binding.BindingException
- org.apache.ibatis.binding.BindingException
- FAQ(9):org.apache.ibatis.binding.BindingException: Type interface com.smbms.dao.UserMapper is not kn
- org.apache.ibatis.binding.BindingException【原因汇总】
- org.apache.ibatis.binding.BindingException【原因汇总】
- org.apache.ibatis.binding.BindingException原因总结
- mybatis 异常:org.apache.ibatis.binding.BindingException
- org.apache.ibatis.binding.BindingException【原因汇总】
- org.apache.ibatis.binding.BindingException【原因汇总】
- org.apache.ibatis.binding.BindingException【原因汇总】
- org.apache.ibatis.binding.BindingException【原因汇总】
- 异常之org.apache.ibatis.binding.BindingException
- cpu
- Nutch2.X使用入坑总结
- lnmp环境下ThinkPHP3.2出现404 Not Found的问题
- Web/APP项目结构组织
- VS2010+Source Insight +PC-Lint开发环境搭建
- org.apache.ibatis.binding.BindingException: Mapper method 'com... has an unsupported return type
- wpf DoubleAnimation对image控件进行缩放旋转
- 百度音乐api接口
- 欢迎使用CSDN-markdown编辑器
- Java(7-2)
- 最大流 Dinic算法
- ScriptManager的使用
- 使用Flash Builder二次开发和编译scratch 2.0
- 阶乘的递归 c代码