------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 先点进去看一下insert方法 用ctrl加鼠标左键点进去看 发现是一个接口SqlSession的方法,没有实现 ,但是通过里氏替换原则的想法,他是接口接收了实现类,所以找他的实现类DefaultSqlSession(idea快捷键ctrl+H) 进去后用ctrl+F查找insert,可以看到多个insert方法构成的重载,但是他们的方法实现调用了这个 public int insert(String st…
insert into test_tb output inserted.id,inserted.data values('c'),('d') delete from test_tb output deleted.id where data='c' update test_tb set data='abc' output inserted.id as ID ,deleted.data as old_data ,inserted.data as new_data where data='c' wit…
operator delete ()全局函数原型: /*operator delete: 该函数最终是通过free来释放空间的*/void operator delete(void *pUserData){_CrtMemBlockHeader * pHead; RTCCALLBACK(_RTC_Free_hook, (pUserData, 0)); if (pUserData == NULL)return; _mlock(_HEAP_LOCK); /* block other threads *…
这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the SqlSession instance is the most powerful class in MyBatis. It is where you'll find all of the methods to execute statements, commit or rollback transacti…
这里做了比较清晰的解释: http://mybatis.github.io/mybatis-3/java-api.html SqlSession As mentioned above, the SqlSession instance is the most powerful class in MyBatis. It is where you'll find all of the methods to execute statements, commit or rollback transacti…
目录 前言 环境配置 错误示范 为什么不能重载? 如何找到XML中对应的SQL? 总结 前言 在初入门Mybatis的时候可能都犯过一个错误,那就是在写Mapper接口的时候都重载过其中的方法,但是运行起来总是报错,那时候真的挺郁闷的,但是自己也查不出来原因,只能默默的改了方法名,哈哈,多么卑微的操作. 今天就写一篇文章从源码角度为大家解惑为什么Mybatis中的方法不能重载? 环境配置 本篇文章讲的一切内容都是基于Mybatis3.5和SpringBoot-2.3.3.RELEASE. 错误示…
mybatis pagehelper想必大家都耳熟能详了,是java后端用于做分页查询时一款非常好用的分页插件,同时也被人们称为mybatis三剑客之一,下面 就给大家讲讲如何在SSM项目和springboot项目中使用mybatis pagehelper 一.mybatis pagehelper在SSM项目中的使用 1.引入maven依赖,(自行选择版本,这里我用的4.1.3) 2.在mybatis的配置文件中进行配置 <plugins> <!--pageNum当前页数 pageSiz…
SSH 通常指的是 Struts2 做前端控制器,Spring 管理各层的组件,Hibernate 负责持久化层. SSM 则指的是 SpringMVC 做前端控制器,Spring 管理各层的组件,MyBatis 负责持久化层. 共同之处是都使用了Spring的依赖注入DI来管理各层的组件,使用了面向切面编程AOP来实现日志管理,权限认证,事务等通用功能的切入. 不同之处是 Struts2 和 SpringMVC 做前端控制器的区别,以及 Hibernate 和 MyBatis 做持久化时的区别…
基本概念 使用SSM(Spring,SpringMVC和Mybatis) 1.1.Spring Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson 在其著作Expert One-On-One J2EE Development and Design中阐述的部分理念和原型衍生而来.它是为了解决企业应用开发的复杂性而创建的.Spring使用基本的JavaBean来完成以前只可能由EJB完成的事情.然而,Spring的用途不仅限于服务器…
SSM:是Spring+Struts+Mybatis ,另外还使用了PageHelper 前言: 这里主要是利用redis去做mybatis的二级缓存,mybaits映射文件中所有的select都会刷新已有缓存,如果不存在就会新建缓存,所有的insert,update操作都会更新缓存.(这里需要明白对于注解写的SQL语句不会操作缓存,我的增加方法是注解写的就没有清空缓存,后来改为XML中写就清空缓存了,这个问题没有解决?) redis的好处也显而易见,可以使系统的数据访问性能更高.本节只是展示了…