奇葩问题:Invalid bound statement (not found): cn.zss.zsdemo.mapper.RoleMapper.selectByPrimaryKey
使用mybatis,遇到Invalid bound statement (not found): cn.zss.zsdemo.mapper.RoleMapper.selectByPrimaryKey 这个问题,困扰了我好几天,在网上找了许多方法使用没有解决。
这个问题不好查,会报这个错的原因太多了,网友整理的查找原因方法如下:
1、检查mapper.xml文件中<mapper namespace="xxxMapper"> 标签是否指向了正确的mapper接口;
我的是正确的
2、检查是否正确显式指定mapper接口所在位置
方式一:启动类上添加注解@MapperScan(“com.xxs.shirodemo.dao”)
方式二:在每一个mapper接口上添加注解@Mapper
3、检查mapper.xml的配置路径是否正确
mybatis:
mapper-locations: classpath*:mapping/*.xml
4、检查mapper接口中的方法名与mapper.xml中操作的id是否相同、是否有一方缺少。
我的问题就出在第3条,我把mybaits配置放在了spring: 下,其实要单独拉出来与spring并列
如图
spring:
datasource:
……
freemarker:
…… mybatis:
mapper-locations: classpath*:mapper/*.xml
type-aliases-package: cn.zss.zsdemo.entity #log4j2
logging:
config: classpath:log4j2.xml
奇葩问题:Invalid bound statement (not found): cn.zss.zsdemo.mapper.RoleMapper.selectByPrimaryKey的更多相关文章
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.e3mall.search.mapper.ItemMapper.getItemList
java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- Invalid bound statement (not found): com.shizongger.chapter2.mapper.UserMapper.insertUser 解决方案
在配置MyBatis时报错信息如下: Invalid bound statement (not found): com.shizongger.chapter2.mapper.UserMapper.in ...
- Invalid bound statement (not found) 找不到mapper 映射文件异常
访问页面报如下错(注意第一行后面的 invalid bound statement (not found)) 这时候再mapper的pom.xml文件要加如下. 否则该节点mybatis的mapper ...
- Invalid bound statement (not found): com.example.managerdemo.mapper.SingleTableMapper.selectAllValuesByConditionsNoPage
报Invalid bound statement (not found): com.example.managerdemo.mapper.SingleTableMapper.selectAllValu ...
- 解决Invalid bound statement (not found)(Mybatis的Mapper绑定问题)
一.问题描述 使用mybatis的项目在本地可以正常运行,但当使用maven或Jenkins打包部署到服务器上时出现了绑定错误,异常信息为: org.apache.ibatis.binding.Bin ...
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.gaiay.business.helper.dao.LiveRegenrationRecordMapper.insert
原因分析: 字段名称.报名.类名 对应不上 ,比如colomn和property属性 反了.. 按以下步骤一一执行: 1:检查xml文件所在的package名称是否和interface对应的packa ...
- Invalid bound statement(not found):cn.e3mall.mapper.TbItemMapper.selectByExample.....
1.出现如下问题: 说明mapper接口和mapper.xml映射文件没有在一个文件夹下面 2.解决方法: 在dao层的pom.xml中配置一下: <!-- 如果不添加此节点mybatis的ma ...
- Mybatis中的Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 找不到Mapper.xml文件的问题
1 首先在配置mapper-locations的时候: classpath: 只在现有目录下寻找配置文件 classpath*: 在现有的项目目录下和依赖的jar包下寻找xml配置文件
- Invalid bound statement (not found): com.up.sell.mapper.system.H5operationMapper.
springboot + mybatis项目,出现这样的错误原因就是mapper类的名字和xml的id不对应或者是忘记写了,仔细检查一下吧
随机推荐
- 【JavaScript】包装类
包装类 String().Number().Boolean() String() 可以将基本数据类型的字符串转换为String对象 var string = new String("hell ...
- Eclipse设置类和方法的注释模板
一.打开设置模板的窗口:Window->Preference->Java->Code Style->Code Template展开Comments,最常用的就是类和方法的注释, ...
- kafka broker
在server.properties文件中配置: 1.broker.id kafka集群是由多个节点组成的,每个节点称为一个broker,中文翻译是代理.每个broker都有一个不同的brokerId ...
- 巧用SimpleDateFormat将Date类型数据按照规定类型转换。
在使用SimpleDateFormat之前,我们来了解一下这个类.SimpleDateFormat is a concrete class for formatting and parsing dat ...
- CG-CTF | MD5
渣渣今天写了一题misc,第一次学习md5的python写法,赶紧记录一波 背景知识: import hashlib md51=hashlib.md5() md52=hashlib.md5() # [ ...
- RESTful风格编程
参考文档:http://blog.didispace.com/springbootrestfulapi/ https://www.jianshu.com/p/91600da4df95 *)RESTfu ...
- Hash算法原理以及HashCode深入理解
Java中的Collection有两类,一类是List,一类是Set.List内的元素是有序的,元素可以重复.Set元素无序,但元素不可重复.要想保证元素不重复,两个元素是否重复应该依据什么来判断呢? ...
- React-Native 之 GD (十三)数据持久化(realm) 及 公共Cell
1.数据持久化 数据持久化是移动端的一个重要部分,刚发现 Realm 原来已经支持 React-Native 了 步骤一: 引入 realm $ npm install realm --save 步骤 ...
- (转)VS2010结合水晶报表做条码标签打印功能
本文转载自:http://blog.sina.com.cn/s/blog_552ca1400100y6dd.html 先来个功能效果图: 大家都知道VS2005和VS2008软件本身是包含水晶报表插件 ...
- 一个包含n个结点的四叉树,每一个节点都有4个指向孩子节点的指针,这4n个指针有(3*n+1)个空指针. 4*n-(n-1) = 3*n+1
因为每个树都有一个头结点.头结点下面是4个子结点,然后每个子结点又有4个子节点.例如一个2层的四叉树,就会有5个结点,但头结点并不能计算进去.他的4个子节点下面接的都是空指针,可以得出空指针的个数为4 ...