service中间调用dao层方法时,出现Mapper method ‘dao.xxx‘ has an unsupported return type错误,但是sql执行修改数据成功,并没有回滚
原因:这个是因为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);
service中间调用dao层方法时,出现Mapper method ‘dao.xxx‘ has an unsupported return type错误,但是sql执行修改数据成功,并没有回滚相关推荐
- Mapper method 'dao.xxx' has an unsupported return type
前后端分离,前端上传数据,后台一直报这个Mapper method 'dao.xxx' has an unsupported return type错误,后来才发现是不需要返回值结果的,把返回值类型改 ...
- Mapper method 'com.XXX.dao.XXXMapper.XXX' has an unsupported return type: class XXX
错误描述: Mapper method 'com.XXX.dao.XXXMapper.updateXXX' has an unsupported return type: class java.lan ...
- NDK学习笔记:JNI调用Java层方法创建Native的AudioTrack播放PCM(方法签名,CallXXXMethod)
NDK学习笔记:JNI调用Java层方法创建Native的AudioTrack播放PCM 题目有点复杂,不过确实就是那么回事.这章想记录的内容比较多,先列出来: native static 与 nat ...
- idea快速从dao层跳转到mapper.xml文件的插件
从dao层跳转到mapper.xml文件的是非常不方便的,但是可以通过此插件来完成快速跳转 以下图解说明安装操作: 来源:https://blog.csdn.net/the_it_world/arti ...
- Mybatis报错01:Mapper method ‘com.feng.dao.UserMapper.deleteUser‘ has an unsupported return type: class
完整报错: org.apache.ibatis.binding.BindingException: Mapper method 'com.feng.dao.UserMapper.deleteUser' ...
- Mapper method ‘com.xxx.dao.ActivityDao.update attempted to return null from a method with a primiti
500异常报告: Mapper method 'com.xxx.dao.ActivityDao.update attempted to return null from a method with a ...
- java方法的调用怎么跳出_JAVA 的一个方法调用另一个方法时,怎么把那个方法里的数据调用出来...
例如:此例子中Calcute()方法调用dispMax()方法时,怎么把curCost的数据调用到publicListgetBidListByName1(Stringname)中来,,,谢谢大家来帮忙 ...
- java两个return_关于java:调用另一个方法时return语句不起作用
我最近开始尝试使用return语句,对此我有一个小疑问-当我有一个调用另一个方法的方法时,将显示我正在调用的方法的return语句吗? 让我们举例说明一下 /** Program to test re ...
- php有没有dao层,php框架开发四(DAO层)_PHP教程
网站开发不可避免地要对一些数据进行储存,但是存储这些数据各种语言的方式基本上都是:先打开连接,然后执行SQL语句,获取结结果,关闭连接. 那么PHP在操作数据库的时候有哪些方法呢? [php] $co ...
最新文章
- 求一个集合的所有子集 Python实现
- mini CentOS7 安装 mysql
- Java源码解析——Java IO包
- 依赖注入_List_Set_Array类型的注入
- Eclipse使用Team explorer everywhere进行代码管理
- linux进程cpu时间片,能讲一下在Linux系统中时间片是怎么分配的还有优先级的具体算法是...
- IDEA这样配置注释模板,让你高出一个逼格!!
- 实战 Comet 应用程序开发
- laravel报错:MassAssignmentException
- Linux下Tomcat死活找不到JSP页面中import指定类的解决方法
- Google整体架构猜想
- 这些文章可以使知识融会贯通
- 自然语言交流系统 phxnet团队 创新实训 个人博客 (十一)
- 【疫情模型】基于matlab改进SEIR模型【含Matlab源码 670期】
- Modifying a Dynamic Library Without Changing the Source Code
- 移动网络安全之无线局域网安全
- 服务器C盘内存不足,发现C盘TEMP文件夹占用44G
- 解决Unable to open debugger port错误
- 湖北武汉劳务员证书劳务人员实名制管理的现状建筑七大员培训
- 解决pip3 install waring ‘The script xxx is installed in ‘/home/xxx/bin‘ which is not on PATH‘
热门文章
- C语言求1到100的和(for循环语句)
- armbian清理_N1盒子armbian/ubuntu/linux系统修改日志输出到内存
- vue项目rem 大屏可视化适配
- mysql 1273错误
- 类型 异常报告 消息 null 描述 服务器遇到一个意外的情况,阻止它完成请求。 例外情况 java.lang.NumberFormatException: null java.base/
- 严重: Compilation error org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
- mysql抢红包功能_Laravel框架实现抢红包功能示例
- log file switch (archiving needed) 等待事件一例
- python 将字符串改成小写
- 南大和中科大计算机哪个好,南京大学和中国科技大学哪个更好?