org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.mapper.BookMapper.selectByPrimaryKey
时间: 2023-11-20 15:57:00 浏览: 128
该错误信息表示在MyBatis中无法找到指定的SQL语句,可能是因为SQL语句的ID或命名空间不正确。解决该问题的方法是检查MyBatis配置文件中是否正确配置了SQL语句的ID和命名空间,并确保SQL语句的ID与Mapper接口中的方法名相同。
以下是一个类似的例子,演示如何解决该问题:
引用:错误信息为:nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.cloud.lowcode.mapper.UserMapper.queryByParam。
引用:将该错误信息翻译成中文为嵌套异常是 org.apache.ibatis.binding.BindingException:无法绑定当前com.cloud.lowcode.mapper包下的UserMapper类的queryByParam方法。
引用:检查MyBatis配置文件中是否正确配置了SQL语句的ID和命名空间,并确保SQL语句的ID与Mapper接口中的方法名相同。
```xml
<!-- MyBatis配置文件 -->
<mappers>
<mapper namespace="com.example.mapper.BookMapper">
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultType="com.example.model.Book">
SELECT * FROM book WHERE id = #{id}
</select>
</mapper>
</mappers>
```
阅读全文
相关推荐
![png](https://img-home.csdnimg.cn/images/20210720083516.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pptx](https://img-home.csdnimg.cn/images/20241231044947.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)