1 动态SQL# 那么,问题来了: 什么是动态SQL? 动态SQL有什么作用? 传统的使用JDBC的方法,相信大家在组合复杂的的SQL语句的时候,需要去拼接,稍不注意哪怕少了个空格,都会导致错误。Mybatis的动态SQL功能正是为了解决这种问题, 其通过 if, choose, when, oth ...
分类:
数据库 时间:
2020-09-16 12:05:52
阅读次数:
40
SpringMVC注解的方式@Controller@RequestMapping@SessionAttributes案例实操@Controller控制器定义在spring3.0中,通过@controller标注即可将class定义为一个controller类。为使springMVC能找到定义为controller的bean,需要在servlet-context配置文件中增加如下定义:<con
分类:
编程语言 时间:
2020-09-14 19:19:51
阅读次数:
55
Invalid bound statement (not found) ...
分类:
编程语言 时间:
2020-09-14 19:15:55
阅读次数:
50
1、导入Mybatis包 使用maven <!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter --> <dependency> <groupId>org.mybatis ...
分类:
编程语言 时间:
2020-09-12 21:45:32
阅读次数:
44
1、Hibernate入门门槛高,mybatis门槛低,易学习, 2、Hibernate开发速度比mybatis快。 hibernate简化dao层,不用考虑SQL语句的编写和结果映射,重点放在业务逻辑上; mybatis需要手写SQL语句以及resultmap,如果有复杂的SQL语句,这时myba ...
分类:
Web程序 时间:
2020-09-12 21:15:17
阅读次数:
47
新公司入职后很久没写博客了,慢慢拾起来吧。 现象描述: 项目本地运行没有问题,打包也没有报错,正常打包。但是部署到服务器在调用查库接口时,报错:Invalid bound statement (not found)。。。。。。。 该错的意思就是调用时没有找到对应的xml文件。 排错思路: mybat ...
分类:
其他好文 时间:
2020-09-10 22:35:47
阅读次数:
47
1.测试类 public class MybatisTest { /** * 入门案例 * @param args */ public static void main(String[] args)throws Exception { //1.读取配置文件 InputStream in = Reso ...
分类:
其他好文 时间:
2020-09-09 19:18:26
阅读次数:
47
参考资料:猿天地 https://mp.weixin.qq.com/s/kp2lJHpTMz4bDWkJYjVbOQ 作者:尹吉欢 技术选型:SpringBoot + Sharding-JDBC + MyBatis 使用Sharding-JDBC配置读写分离,优点在于数据源完全有Sharding托管 ...
分类:
数据库 时间:
2020-09-09 19:05:46
阅读次数:
60
废话少说,上代码 结构: 1application.properties web.upload-path=G:\study_tool\maven_workspace\images#\u9759\u6001\u8D44\u6E90\u6587\u4EF6spring.resources.static- ...
分类:
数据库 时间:
2020-09-08 21:05:22
阅读次数:
66
解决属性名和字段名不一致的问题 1. 问题 在数据库中,密码字段为pwd,而在实体类中为password package com.wang.pojo; public class User { private int id; private String name; private String pa ...
分类:
其他好文 时间:
2020-09-08 20:49:45
阅读次数:
46