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">
- id不一致
浙公网安备 33010602011771号