MyBatis: Invalid bound statement (not found)错误的可能原因

MyBatis: Invalid bound statement (not found)错误的可能原因

其他原因导致此问题解决参考:

1.检查 xml 文件所在 package 名称是否和 Mapper interface 所在的包名一致

<mapper namespace="com.xiaopengwei.mapper.UserInfoMapper">

mapper 的 namespace 写的不对!!!注意系修改。

2.UserDao 的方法在 UserDao.xml 中没有,然后执行 UserDa o的方法会报错误

3.UserDao 的方法返回值是 List<User>,而 select 元素没有正确配置 ResultMap,或者只配置ResultType!

4.如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存.问题解决

5.看下 mapper 的 XML 配置路径是否正确

mybatis.mapper-locations=classpath*:mybatis/oracle/*.xml

6.多数是 xml 文件中内容的问题,注意对应!

原文地址:https://www.cnblogs.com/xpwi/p/11225139.html

时间: 2024-08-13 12:51:41

MyBatis: Invalid bound statement (not found)错误的可能原因的相关文章

转载:Maven项目mybatis Invalid bound statement (not found)解决方法

在mapper代理的开发中,程序员需要遵守一些规范,mybatis才能实现mapper接口的代理对象. 它的规范如下: mapper.xml的namespace要写所映射接口的全称类名. mapper.xml中的每个statement的id要和接口方法的方法名相同 mapper.xml中定义的每个sql的parameterType要和接口方法的形参类型相同 mapper.xml中定义的每个sql的resultType要和接口方法的返回值的类型相同 mapper.xml要和对应的mapper接口在

在使用mybatis的selectFromExample时出现Invalid bound statement (not found)错误

主要原因:运行项目在构建的时候只会默认的去加载resource资源文件里面的资源,其他地方的配置资源不会加载 .故没有读取到mybatis的MapperXml映射 结构如下 ============================================================= tomcat控制台报错如下: 三月 22, 2018 8:31:52 下午 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet

Invalid bound statement (not found) 错误原因

对我来说,错误的原因是因为没有配置:mybatis.mapperLocations=classpath:mybatis/mapper/*Mapper.xmlmybatis.config-location=classpath:mybatis/mybatis-config.xml 导致主库是可以正常连接数据库会员分库则报出Invalid bound statement (not found) 错 原文地址:https://www.cnblogs.com/liumz0323/p/10869669.ht

关于mybatis Invalid bound statement (not found) 问题

初学mybatis   现在系统是spring + mybatis  applicationContext.xml里面配置了Mapper 自动扫描 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">    <property name="basePackage" value="com.yolly.platform.*" /></bean&g

关于 Mybatis 的Invalid bound statement (not found):错误

今天遇到一个特别奇怪的问题,最后发现是自己对mybatis的学习还有待提高 返回类型可以用resultType,也可以用resultMap resultType是直接表示返回类型的,而resultMap则是对外部ResultMap的引用 举个例子: resultMap: <select id="findByContract" resultMap="BaseResultMap">        select        *        from    

MyBatis 诡异的Invalid bound statement not found 错误

自从开始使用Maven管理项目,最近在配置MyBatis的Mapper,在Eclipse上调试时都是正常的,但是最近把项目迁移到 IntelliJ IDEA 上后发现不管是直接用Jetty调试,还是打成war发布均报错. 根据错误提示初步判断是配置的问题,检查的Spring和MyBatis所有配置文件,甚至在SVN上回退了代码,可问题均没有解决:无奈暂时换回了Eclipse继续Coding- 一直怀疑是迁移至IntelliJ IDEA造成的问题,于是自己新建了个Maven项目,调试MyBatis

Mybatis:Invalid bound statement (not found)

今天在使用SSM做整合练习的时候写完初始的一个查询功能,想测试下环境是否正确,出现了这个问题, 找个半天才发现自己的问题.网上很多说Mapper.xml中的namespace写的问题,但是我出现的问题却不在这. 由于用Spring去整合Mybatis,不在需要mybatis的配置文件. 出错的时候是这样: <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"&

解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误

我调这个bug调了一天多,在网上搜索的检查namespace,package等,都没有错.错误提示是没有找到xml文件,我就纳闷了,为什么找不到呢?后来才发现,原来是resource中奇怪的目录为题,可以看着两个链接:https://jingyan.baidu.com/article/93f9803f51225fe0e56f5573.html,https://blog.csdn.net/benben513624/article/details/81076182. 在创建resources下目录时

myBatis的binding错误:Invalid bound statement (not found)

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误这个问题我找了好久,终于找到了正确的写法: <select id="getEmpByIdAndLastName" resultType="com.atguigu.mybatis.bean.Employee"> select id, last_name, gender, email from tb