zoukankan      html  css  js  c++  java
  • Mybatis报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)问题解决办法汇总

    今天遇到了这个错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),结果查询出来的办法如下:

    1. mybatis的xml文件的命名空间写错,命名空间应该是xml对应的数据接口类。
      例如:类名是com.xxx.dao.MyMapper接口,那么xml就应该配置成
    2. mybatis的xml文件中没有数据接口类中接口对应的方法,或者方法参数有误。
      例如:接口类中定义了public List listMyBean(MyBean bean),那么xml中应该有<select id="listMyBean" parameterType="com.xxx.bean.MyBean" resultType="com.xxx.bean.MyBean"></select>的标签
    3. mybatis的xml和数据接口类所在的包一致,或者配置mybatis.mapper-locations参数。
      例如: 如果类名是com.xxx.dao.MyMapper接口,那么对应方式的xml有如下配置:
      a. xml放在resources目录下的com/xxx/dao/MyMapper的目录下;
      b. xml放在resources目录下的指定目录下(例如mapper目录),则在application.xml中指定mybatis.mapper-locations(例如:mybatis.mapper-locations= classpath:/mapper/*.xml)
      或者在application.yml中指定
      mybatis:
      mapper-locations: classpath:/mapper/*.xml
      这个样子。
  • 相关阅读:
    SDUT_1743 最优合并问题
    并查集路径压缩方法
    java定时器
    出路在哪里?出路在于思路!
    ztree学习
    sql
    java乱码问题详解值得收藏
    js 增加删除表格的行
    java DataBaseExecutor
    java增删改查
  • 原文地址:https://www.cnblogs.com/Lenbrother/p/13041785.html
Copyright © 2011-2022 走看看