详细出错代码:
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.mgy.mapper.UserMapper.findById'. It's likely that neither a Result Type nor a Result Map was specified.
### The error may exist in cn/mgy/mapper/xml/UserMapper.xml
### The error may involve cn.mgy.mapper.UserMapper.findById
### The error occurred while handling results
### SQL: SELECT * FROM t_user where uid = ?
### Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.mgy.mapper.UserMapper.findById'. It's likely that neither a Result Type nor a Result Map was specified.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
at com.sun.proxy.$Proxy4.findById(Unknown Source)
at cn.mgy.test.UserTest.findById(UserTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
解决方案:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="cn.mgy.mapper.UserMapper">
<insert id="insert">
INSERT INTO t_user (uname, pwd, age) VALUES (#{uname}, #{pwd}, #{age});
</insert>
<delete id="deleteById">
DELETE FROM t_user WHERE uid=#{uid}
</delete>
<update id="upUnameById">
UPDATE t_user SET uname=#{uname} WHERE uid=#{uid}
</update>
<select id="findById"> 修改为:<select id="findById" resultType="cn.mgy.pojo.User">
SELECT * FROM t_user where uid = #{uid}
</select> </mapper>
出错:Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'cn.mgy.mapper.UserMapper.findById'.的更多相关文章
-
ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.win.mall.dao.CartMapper.test’. It’s likely that neither a Result Type nor a Result Map was specified.
ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.win.m ...
-
Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: java.sql.SQLException: 不支持的特性
mybatis插入数据时报错: Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated key or ...
-
SpringBoot报错:nested exception is org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk.test.User matching [java.lang.Long, java.lang.String, java.lang.String]
错误提示: Caused by: org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk._16 ...
-
Mybatis报错Cause: org.apache.ibatis.executor.ExecutorException: Executor was closed.
SqlSession被关闭了,检查是否使用了被关闭的SqlSession.
-
mybatis插入出现org.apache.ibatis.executor.ExecutorException: No setter found for the keyProperty &#39;xxx&#39;异常的原因
确定有setter方法,问题其实是xml文件中,insert的主键的列名写错了,如下,一开始写成ComId <insert id="insertCom" parameterT ...
-
org.apache.ibatis.executor.ExecutorException: No constructor found in xxxClass matching [java.lang.String, java.lang.Long, java.lang.String, java.lang.String, java.sql.Timestamp]
解决方案 为bean加上默认构造方法 public class User { private String username; private long id; private String sex; ...
-
Mybatis出现错误org.apache.ibatis.executor.ExecutorException: No constructor found in
错误显示没有发现构造器. 其实就是重写了构造器后,忘了补写一个默认的空参构造器了.此类的错误还经常出现在spring等这种大量使用反射的框架中.因为这些框架在调用反射的类后会默认调用默认的构造器 解决 ...
-
mybatis查询异常-Error querying database. Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List
背景,mybatis查询的时候直接取的sqlsession,没有包装成SqlSessionTemplate,没有走spring提供的代理. 然后我写的获取sqlsession的代码没有考虑到并发的情况 ...
-
java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; 	at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.jav
在整合spring和mybatis在执行数据库操作的时候报出了: java.lang.AbstractMethodError: org.mybatis.spring.transaction.Sprin ...
随机推荐
-
实验7 BindService模拟通信
实验报告 课程名称 基于Android平台移动互联网开发 实验日期 2016.4.16 实验项目名称 BindService模拟通信 实验地点 S30010 实验类型 □验证型 √设计型 ...
-
今天做项目时,用到了好多关于js的知识点,有的忘记了,然后晚上回来自己整理一番,明天继续整理。哈哈,分享给大家。
javascript 数据类型 typeof (直接量/变量)-------判断数据类型 简单数据类型(栈,空间小,速度快) string字符串 用引号引起来的文本 number数字 所有数字 NaN ...
-
FastSocket客户端/服务端通讯示例
新建控制台项目,命名为Server 添加FastSocket.SocketBase,FastSocket.Server引用 Socket命令服务类: Sodao.FastSocket.Server ...
-
推荐第三方Oracle客户端查询工具
1.SqlDbx 官方地址:http://www.sqldbx.com/personal_edition.htm 2.devart http://www.devart.com/dbforge/orac ...
-
J2EE的十三种技术(规范)
J2EE的十三种技术(规范) Java数据库连接(JDBC) JDBC API以一个统一的方式访问各种数据库.与ODBC类似,JDBC将开发者和私有数据库之间的问题隔离开来.由于它建立在Java上, ...
-
asp.net向后台传参数动态加载图片
//向后台传参数动态加载图片 $(function() { $("#Button1").click(function() { var stockcode = getUrlParam ...
-
poj 1949 Chores 最长路
题目链接 求出最长路..... #include <iostream> #include <vector> #include <cstdio> #include & ...
-
基础总结篇之五:BroadcastReceiver应用具体解释
問渠那得清如許?為有源頭活水來.南宋.朱熹<觀書有感> 据说程序猿是最爱学习的群体,IT男都知道,这个行业日新月异,必须不断地学习新知识,不断地为自己注入新奇的血液,才干使自己跟上技术的步 ...
-
IDEA Maven 三层架构 1、基本的Archetype 搭建
JDK:1.8 Maven:3.3.9 三层架构:基于 SpringMVC 的 UI 层.业务逻辑层以及数据访问层 从对 Maven 的了解可以看出,三层架构的创建在于对文件夹的合理安排,他们通常是主 ...
-
JavaScript数据结构与算法(一) 栈的实现
TypeScript版本源码 class Stack { items = []; public push(element) { this.items.push(element); } public p ...