今天遇到一个特别奇怪的问题,最后发现是自己对mybatis的学习还有待提高

返回类型可以用resultType,也可以用resultMap

resultType是直接表示返回类型的,而resultMap则是对外部ResultMap的引用

举个例子:

resultMap:

<select id="findByContract" resultMap="BaseResultMap">
        select
        *
        from
        user
        where
        tel=#{tel}
    </select>

resultType:

<select id="getCountGroupbyUserSex" resultType="com.iswust.controller.vo.stat.StatUserSexBean">
        select sex as
        type,count(*) as count from user group by sex;
    </select>

<select id="findConnectByid" resultType="java.lang.String">
        select
        tel
        from
        user
        id=#{user_id}
    </select>

以后再也不要犯这么愚蠢的错误啦

关于 Mybatis 的Invalid bound statement (not found):错误的更多相关文章

  1. myBatis中Invalid bound statement (not found)错误

    环境:Idea.ssm.maven 由于使用maven的原因,maven不会扫描到mapper的xml文件所以会出现此类问题. 每次走到mapper方法时就抛异常:Invalid bound stat ...

  2. mybatis提示Invalid bound statement (not found)错误的可能原因

    https://www.cnblogs.com/liaojie970/p/8034525.html

  3. MyBatis: Invalid bound statement (not found)错误的可能原因

    MyBatis: Invalid bound statement (not found)错误的可能原因 其他原因导致此问题解决参考: 1.检查 xml 文件所在 package 名称是否和 Mappe ...

  4. mybatis:Invalid bound statement (not found)

    [常规解决办法] 如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因 ...

  5. 在使用mybatis的selectFromExample时出现Invalid bound statement (not found)错误

    主要原因:运行项目在构建的时候只会默认的去加载resource资源文件里面的资源,其他地方的配置资源不会加载 .故没有读取到mybatis的MapperXml映射 结构如下 ============= ...

  6. mybatis 报Invalid bound statement(not found) 和 Property 'mapperLocations' was not specified or not matching resources found

    排除问题的步骤: 1.首先检查mapper文件和mapper接口的文件名是否相等. 2.pom.xml是否把xml排除了,这样写就会src/main/java下所有的Mybatis的xml文件都删除, ...

  7. mybatis Invalid bound statement (not found)错误解决办法

    由于新版的IntelliJ IDEA不再编译source folder下的xml文件,而我们平时使用mybatis时,习惯于将*Mapper.xml文件放在与dao层.service层平级的src目录 ...

  8. 解决Mybatis的invalid bound statement (not found)异常

    使用Maven构建SSM时, 需要在pom.xml中配置一些信息, 否则mapper.xml就无法被扫描到, 程序就会抛invalid bound statement (not found)异常 解决 ...

  9. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误几种解决方案

    报错信息: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.study.ser ...

随机推荐

  1. 分布式监控系统Zabbix-3.0.3-完整安装记录(2)-添加mysql监控

    Zabbix3.0 Server以后就自带了MySQL插件来监控mysql数据库的模板,只需要配置好agent客户端,然后在web端给主机增加模板就行了. 以下是公司线上的zabbix3.0环境下添加 ...

  2. Edit Distance

    Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert  ...

  3. LeetCode "448. Find All Numbers Disappeared in an Array"

    My first reaction is to have an unlimited length of bit-array, to mark existence. But if no extra me ...

  4. C/C++实践笔记 005

    整型常量int a=101u; 无符号整数int b=102l; 长整数int c=103ll; long long整数 存储qq号,手机号 010八进制 0x10十六进制 嵌入式的场合经常用shor ...

  5. .NET 常用框架

    1.Hangfire 2.Lucene.Net 3.Log4Net 4.Quartz.Net 5.Autofac 6.SqlSugar 7.NPOI 8.Senparc.Weixin.MP 9.Aut ...

  6. mysql数据库表结构导出

    mysql数据库表结构导出 命令行下具体用法如下: mysqldump -u用戶名 -p密码 -d 数据库名 表名 > 脚本名; 导出整个数据库结构和数据 mysqldump -h localh ...

  7. for循环嵌套执行效率

    今天做项目时遇到一个for循环的嵌套问题,一个循环次数多,一个次数少,怎样设计效率较高. 想起以前笔试时遇到过这个问题,当时由于时间仓促,没有细想,今天在实际代码中遇到这么问题,于是动笔算了下. 设两 ...

  8. 在ubuntu/deepin/mint等系统中使用命令删除文件或文件夹

    此命令操作需谨慎: sudo rm -rf 文件夹路径(或文件路径)  

  9. Angular指令渗透式理解

    通过一段时间对angular指令的使用,理解了angular指令的意义,下面逐一介绍一下. ng-app:定义一个angualr模块,表示angular作用的范围,如下代码: ng-app在html标 ...

  10. windows bat 设置代理上网脚本bat

    取消IE代理服务器 ****************************************************************************************** ...