奇葩问题: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不对应或者是忘记写了,仔细检查一下吧
随机推荐
- Angular前端开源框架
1. 项目框架介绍 本项目采用了开源项目ngx-admin作为脚手架.基于Angular 8 +,Bootstrap 4+和Nebular,ngx-admin是最受欢迎的后台管理模板,是用于个人和商 ...
- mybatis学习$与#号取值区别
1,多个参数传递用map或实体封装后再传给myBatis, mybatis学习$与#号取值区别 #{} 1.加了单引号, 2.#号写是可以防止sql注入,比较安全 select * from use ...
- 靠!老师居然叫我们去写博弈论!!!结果写了一个晚上的博弈论,简直要死QAQ。。。发发博客休息一下。。。TAT。。。
萌萌的糖果博弈 题目描述: 用糖果来引诱小朋友学习是最常用的手法,绵羊爸爸就是用糖果来引诱萌萌学习博弈的.他把糖果分成了两堆,一堆有A粒,另一堆有B粒.他让萌萌和他一起按照下面的规则取糖果:每次可以任 ...
- Redis-cli相关命令
> flushdb > SELECT OK []> GET db_number (nil) []> []> flushdb OK []> SELECT OK > ...
- php命令行工具
https://jingyan.baidu.com/article/37bce2beb6e5681002f3a20f.html
- Seaborn 绘图代码
seaborn单变量.多变量及回归分析绘图 https://blog.csdn.net/llh_1178/article/details/78147822 Python数据科学分析速查表 https: ...
- oracle各服务说明及cmd启动启动命令
成功安装Oracle 11g后,共有7个服务,一.这七个服务的含义分别为:1. Oracle ORCL VSS Writer Service:Oracle卷映射拷贝写入服务,VSS(Volume Sh ...
- 架构-数据库访问-SQL语言进行连接数据库服务器-DB-Library:DB-Library
ylbtech-数据库访问-SQL语言进行连接数据库服务器-DB-Library:DB-Library 1.返回顶部 1. 在基于三层构架的信息系统开发中,应用服务器要利用SQL语言进行连接数据库服务 ...
- MyBatis逆向工程去除表名前缀
https://www.jianshu.com/p/e09d2370b796 https://blog.csdn.net/baidu_16757561/article/details/75071476 ...
- Delphi XE2 之 FireMonkey 入门(23) - 数据绑定: TBindingsList: TBindExpression
准备用 TBindingsList 重做上一个例子. 可以先把 TBindingsList 理解为是一组绑定表达式(TBindExpression)的集合;官方应该是提倡在设计时完成 TBindExp ...