Invalid bound statement (not found): com.xzit.mapper.StudentMapper.selectList
这个错误通常是因为Mybatis无法找到对应的Mapper映射文件或者Mapper接口方法名与映射文件中定义的不一致导致的。解决方案如下:
确认Mapper接口上是否添加了@Mapper注解,如果没有添加,可以在接口上添加该注解。
确认Mapper接口上的方法名是否与映射文件中定义的一致,包括大小写和参数个数等。
确认Mapper映射文件的路径是否正确,可以在启动类上添加@MapperScan注解指定Mapper接口所在的包路径。
确认Mapper映射文件的命名是否正确,需要与Mapper接口的名称一致,并且后缀名为.xml。
确认Mapper映射文件中是否定义了对应的SQL语句,可以通过在Mapper接口上添加@Select等注解来指定SQL语句。
下面是一个示例代码,可以参考一下:
@Mapper
public interface StudentMapper {
@Select("SELECT * FROM student")
List<Student> selectAll();
}
Invalid bound statement (not found): com.example.demo.mapper.StudentMapper.selectPage
在解决这个问题时,我们需要参考多个引用内容。首先,我们可以看到引用提到了BaseMapper使用了范型。这意味着我们的UserMapper在继承BaseMapper时也需要写上对应的范型。接下来,引用给出了解决方案之一,即创建Mapper.xml文件时需要注意一些细节。最后,引用给出了另一个解决方案,即在pom.xml文件中添加一些配置来指定mapper.xml文件的位置。
所以,对于你提到的错误信息"Invalid bound statement (not found): com.example.demo.mapper.StudentMapper.selectPage",可能是由于在StudentMapper中的selectPage方法没有正确映射到对应的mapper.xml文件中引起的。你可以检查一下是否在StudentMapper.xml文件中正确配置了selectPage方法。同时,也要确保你的UserMapper正确继承了BaseMapper,并且写上了对应的范型。
另外,你也可以尝试参考引用和中的解决方案来解决这个问题。通过注意创建Mapper.xml文件的细节和在pom.xml文件中添加相关配置,可能会有助于解决该错误。123
引用[.reference_title]
- 1 mybatis-plus出错:Invalid bound statement (not found): com.kuang.mapper.UserMapper.selectList[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
allinsert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - 2 3 idea Mapper .XML 文件没有构建成功:Invalid bound statement (not found): com.example.xx项目.mapper[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
allinsert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.kjb.jm.mapper.StudentMapper.selectList
org.apache.ibatis.binding.BindingException是MyBatis框架中的一个异常类,通常发生在Mapper文件或Java接口与SQL语句绑定时出现问题。在您提供的异常信息中,报错信息为“Invalid bound statement (not found): com.kjb.jm.mapper.StudentMapper.selectList”,意思是说MyBatis无法找到指定的SQL语句。可能的原因是您的Mapper XML文件或Java接口中没有定义名为selectList的SQL语句,或者这个SQL语句定义有误。请仔细检查这些方面并修正错误后再进行调试。
相关推荐
















