后端框架学习-----mybatis(使用mybatis框架遇到的问题)
2024-10-20 16:16:53
1、配置文件没有注册(解决:在核心配置文件中注册mapper,注册有三种形式。资源路径用斜杆,包和类用点)
<mappers>
<!--每一个mapper.xml文件都需要在mybatis核心配置文件中被注册-->
<mapper resource="com/zheng/Dao/UserMapper.xml"></mapper>
</mappers>
2、绑定接口错误(解决:在mapper.xml文件中,namespace是要实现的接口类)
<mapper namespace="com.zheng.Dao.UserMapper">
3、方法名不对(解决:id是接口中对应的方法名)
<select id="selectAllUser" resultType="com.zheng.pojo.User">
select * from mybatis.user
</select>
4、返回类型不对
<select id="selectAllUser" resultType="com.zheng.pojo.User">
select * from mybatis.user
</select>
5、maven导出资源出问题
<!--在build中配置resources,来防止我们资源导出失败的问题-->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
6、时区问题(解决在核心配置文件中)
serverTimezone=Asia/Shanghai"
7、utf-8问题
在核心配置文件和mapper中将utf-8改为utf8
最新文章
- 基本矩阵运算的Java实现
- CAD二次开发
- hdu1166-敌兵布阵(线段树)
- 【BZOJ2318】【spoj4060】game with probability Problem 概率DP
- ANDROID_MARS学习笔记_S05_005_方向传感器
- js下firstElementChild firstChild 以及childNodes和children方法
- IOS设计模式学习(21)享元
- 第三方库AFNetworking 3.1.0的简单使用
- python批量提取eml附件
- Linux中断管理 (2)软中断和tasklet
- JavaScript原生秒表、计时器
- C++ 提取网页内容系列之三
- 【Linux】VMware虚拟机中如何配置静态IP
- composer----------composer基本命令和遇到一些问题解决方案
- spring boot 开发非web应用程序
- 谈谈选用技术的原则,技术学习方法技巧,阅读代码的技巧及其它 MSF的一点心得
- VC调用DLL
- Filter—过滤器
- 机器学习之step by step实战及知识积累笔记
- angularJs 页面{{xxx}}使用三目运算符
热门文章
- Python-基础学习-第二轮
- Eclipse里项目名有红叉,但是项目里的每一个文件都没有红叉
- Python带我起飞——入门、进阶、商业实战_ 入门版电子书籍分享,
- Luogu3870 [TJOI2009]开关 (分块)
- 在centos服务器里安装opencv的坑:mportError: libXrender.so.1: cannot open shared object file: No such file or directory and wrong ELF class: ELFCLASS32
- 前端必备的 HTTP 知识
- 批处理(bat)命令修改xml模板数据
- KingbaseES XA 分布式事务
- 阿里云Centos7部署私人CSGO服务器
- eclipse 统一设置编码_项目工程统一设置成utf8编码_eclipse代码规范