当前位置:网站首页>mybaits-puls 在xml文件中写sql语句 会报错 Invalid bound statement (not found):
mybaits-puls 在xml文件中写sql语句 会报错 Invalid bound statement (not found):
2022-06-11 06:58:00 【CSDN问答】
mybaits-puls 在xml文件中写sql语句 会报错 Invalid bound statement (not found): com.keke.mapper.EmpMapper.Select5
//查询10号部门中工种为MANAGER和20部门中工种为CLERK的员工的信息。 @GetMapping("Select5") public Result Select5(){ List<Emp> emps=empService.Select5(); System.out.println(emps); return Result.success(emps); }//-----------------------------------------------------用注解方式是正常的 把注解方式注释掉 试试xml写法 //@Select("select * from emp where job='MANAGER' and deptno=10 union select * from emp where job='CLERK' and deptno=20") List<Emp> Select5();//------------------------------------------------------------- <mapper namespace="com.keke.mapper.EmpMapper"> <resultMap id="BaseResultMap" type="com.keke.domain.Emp"> <[email protected]> <[email protected] emp--> <id column="EMPNO" jdbcType="INTEGER" property="empno"/> <result column="ENAME" jdbcType="VARCHAR" property="ename"/> <result column="JOB" jdbcType="VARCHAR" property="job"/> <result column="MGR" jdbcType="INTEGER" property="mgr"/> <result column="HIREDATE" jdbcType="DATE" property="hiredate"/> <result column="SAL" jdbcType="DECIMAL" property="sal"/> <result column="COMM" jdbcType="DECIMAL" property="comm"/> <result column="DEPTNO" jdbcType="INTEGER" property="deptno"/> </resultMap> <sql id="Base_Column_List"> <[email protected]> EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO </sql> <select id="Select5" resultMap="BaseResultMap" > select <include refid="Base_Column_List"></include> from emp where JOB='MANAGER' and DEPTNO=10 union select <include refid="Base_Column_List"></include> from emp where JOB='CLERK' and DEPTNO=20 </select></mapper>直接报错
Invalid bound statement (not found): com.keke.mapper.EmpMapper.Select5
感觉就是扫描不到 xml文件 (不知道是不是)
但是在配置文件却配置了
##配置数据源
spring:
datasource:
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
username: root
password: 123456
max-active: 10 #最大活跃连接数
min-idle: 5 #小小的活跃连接数
validation-query: select 'x' #验证连接是否可用的sql
#监控页
stat-view-servlet:
enabled: true #开启数据源监控
login-username: keke
login-password: keke
allow: #允许连接的IP --白名单
deny: #不允许连接的IP --黑名单
url-pattern: /druid/*
#开启mybatis的配置
mybatis:
mapper-locations: classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #配置sql控制台输出
在启动类上也配置了
@MapperScan(basePackages = {"com.keke.mapper"})
网上的常规方法都是试过了!有没有人指点下
边栏推荐
- 关于 QtCreator的设计器QtDesigner完全无法正常拽托控件 的解决方法
- Oracle prompt invalid number
- Prototype and prototype chain
- Xunwei dry goods | Ruixin micro rk3568 development board TFTP & NFS writing (Part 1)
- Zabbix 监控主机是否在线
- saltstack部署lnmp
- 必读1:格局越大的人,越懂得说话
- About daily report plan
- 关于组织开展2022年宁波市重点首版次软件申报工作的通知
- Analysis of key points and difficulties of ES6 promise source code
猜你喜欢

Leetcode hot topic 100 topic 11-15 solution
![[]==! []](/img/65/ab724c74b080da319ed5c01c93fdb7.png)
[]==! []

Check whether the filing information of the medical representative is correct

During unity panoramic roaming, AWSD is used to control lens movement, EQ is used to control lens lifting, and the right mouse button is used to control lens rotation.

VTK vtkplane and vtkcutter use

ESP32学习笔记(49)——ESP-WIFI-MESH接口使用

Starting from scratch (V) realize bullet positioning and animation

.NET C#基础(6):命名空间 - 有名字的作用域

Stack -- one of two common linear structures of linear structure

The realization of online Fox game server room configuration battle engagement customization function
随机推荐
WPF data binding (IV)
Cross-Modal Pattern-Propagation for RGB-T Tracking
[Xunwei dry goods] opencv test of Godson 2k1000 development board
必读1:格局越大的人,越懂得说话
Starting from scratch (V) realize bullet positioning and animation
[matlab printed character recognition] OCR printed letter + number recognition [including source code 1861]
核查医药代表备案信息是否正确
Practice: how to reasonably design functions to solve practical problems in software development (II) -- improving reusability
SQL语言-查询语句
Whether the ZABBIX monitoring host is online
Won't virtual DOM be available in 2022? Introduction to virtual Dom and complete implementation of diff and patch
Graph Attention Tracking
六月集训(第11天) —— 矩阵
3.1 测试函数的命名规则
Appclips & tips (continuous update)
Notice on organizing the application for the first edition of Ningbo key software in 2022
Required reading 1: the larger the pattern, the better they know how to speak
【Matlab图像加密解密】混沌序列图像加密解密(含相关性检验)【含GUI源码 1862期】
Shuttle container component
How to make time planning