mybatis 报错 invalid bound statement (not found)

invalid bound statement (not found) 

释义:无效绑定语句(未找到)

root cause归类起来无外以下两种原因

  • 代码错误
  • 配置错误

排查方法

  • case1 如果所有mapper层中的方法都报错,那肯定是全局的配置问题;检查mybatis配置
mybatis-plus:
  type-aliases-package: com.xxx.server.entity,;com.xxx.xxx.entity
  mapper-locations: classpath*:mapper/**/*Mapper.xml
  • case2 某个mapper.xml中的所有方法都报错,
    • 大概率是namespace配置错误
    • 文件名命名错误,mapper scan没有扫描到
<mapper namespace="com.xxx.xxxDao">
  • case3 某个方法报错
    • id不一致
      <select id="xxx" resultType="java.lang.String">
      

如果以上都未匹配,清除IDE缓存重新build

posted on 2023-08-26 00:05  博客园里的蜗牛  阅读(58)  评论(0编辑  收藏  举报

导航