Resolved [org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
时间: 2023-09-22 08:10:36 浏览: 133
引用<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.xxx.xxx 的解决...](https://blog.csdn.net/Hello_World_QWP/article/details/126713075)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
相关问题
mybatisplus Resolved [org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
mybatisplus是一个基于MyBatis的增强持久化框架。根据提供的引用内容,出现"org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)"错误通常是因为在使用MyBatis-Plus时,Mapper接口与Mapper XML文件的绑定失败所致。
Resolved [org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ruoyi.test.mapper.ShangMapper.selectList]
这个错误通常是因为MyBatis找不到或无法匹配接口方法和XML映射文件中的语句引起的。解决此问题的步骤如下:
1.检查mapper接口的包路径和mapper配置文件中的namespace是否匹配。
2.检查mapper配置文件中是否存在与接口方法名称相同的语句。
3.检查mapper接口方法的参数类型是否与mapper配置文件中的语句参数类型匹配。
4.检查mapper配置文件中的语句是否正确,例如语句中的表名、列名是否正确。
以下是可能解决此问题的代码示例:
1.检查mapper接口的包路径和mapper配置文件中的namespace是否匹配。
```xml
<!-- mapper配置文件 -->
<mapper namespace="com.test.mapper.UserMapper">
<select id="selectList" resultType="com.test.entity.User">
select * from user
</select>
</mapper>
// mapper接口
package com.test.mapper;
public interface UserMapper {
List<User> selectList();
}
```
2.检查mapper配置文件中是否存在与接口方法名称相同的语句。
```xml
<!-- mapper配置文件 -->
<mapper namespace="com.test.mapper.UserMapper">
<select id="selectList" resultType="com.test.entity.User">
select * from user
</select>
<select id="selectListById" resultType="com.test.entity.User">
select * from user where id = #{id}
</select>
</mapper>
// mapper接口
package com.test.mapper;
public interface UserMapper {
List<User> selectList();
}
```
3.检查mapper接口方法的参数类型是否与mapper配置文件中的语句参数类型匹配。
```xml
<!-- mapper配置文件 -->
<mapper namespace="com.test.mapper.UserMapper">
<select id="selectListById" resultType="com.test.entity.User">
select * from user where id = #{id}
</select>
</mapper>
// mapper接口
package com.test.mapper;
public interface UserMapper {
User selectListById(Long id);
}
```
4.检查mapper配置文件中的语句是否正确,例如语句中的表名、列名是否正确。
```xml
<!-- mapper配置文件 -->
<mapper namespace="com.test.mapper.UserMapper">
<select id="selectList" resultType="com.test.entity.User">
select * from users
</select>
</mapper>
// mapper接口
package com.test.mapper;
public interface UserMapper {
List<User> selectList();
}
```
阅读全文
相关推荐
















