MyBatis source code analysis
Phase source code details:
Through a simple demo for single step debugging, it is convenient to have a deep understanding of each step of Mybatis. The example is as follows:
public class MybatisLearn {
public static void main(String[] args) throws IOException {
String resource = "mybatis-config.xml";
InputStream inputSt ...
Posted by buck2bcr on Wed, 30 Oct 2019 08:51:49 -0700
Mybatis source code mybatis agent stage
When using Mybatis, you may have a question: why can you only write Mapper interface to operate database?
Its main idea is to use dynamic agent to generate implementation class, and then cooperate with SQL statement in xml Mapping file to access database. Let's take a look at the source code.
binding module core class
Mapper registry: the regi ...
Posted by cyberplasma on Wed, 30 Oct 2019 00:06:53 -0700
SSM environment construction
SSM environment construction
Create project
General directory structure
Specific file configuration
Run Tomcat
Operation result
SSM(Spring+SpringMVC+MyBatis), the framework of web project
First of all, ensure that the Maven configuration is completed and that the image source is replaced by domest ...
Posted by pyro3k on Tue, 29 Oct 2019 14:53:15 -0700
Integration and use of SSM framework -- to realize simple transfer system
I. integration ideas
SSM framework, namely spring MVC + Spring + mybati framework set, is a lightweight Web open source framework. The modules they are responsible for in the JAVA three-tier architecture are as follows:
Among them, there is an inclusion relationship between spring MVC and spring, so there is no need to integrate them, just ...
Posted by nemethpeter on Tue, 29 Oct 2019 03:54:14 -0700
oracle+mybatis bulk insert data
1.Oracle batch operation
My watch structure is
1.1 batch insertion
1.1.1 primary key does not use sequence
insert into students(sid,sname,ssal,ssex)
select 9,'Zhang San',3000,'male' from dual
union all select 10,'Li Si',4000,'male' from dual
union all select 11,'Xiaohong',5000,'female' from dual
...
Posted by Alkimuz on Mon, 28 Oct 2019 08:29:39 -0700
Mybaits source code analysis ---- create SqlSessionFactory according to the Configuration file (Configuration creation process)
We use mybatis to operate the database through the API call of SqlSession, and create SqlSession through SqlSessionFactory. Let's take a look at the creation process of SqlSessionFactory.
Profile resolution portal
Let's look at the test method in the first article
1 public static void main(String[] args) throws IOException {
2 Strin ...
Posted by rommel_toledo on Sun, 27 Oct 2019 23:53:57 -0700
Basic steps and code of Mybatis framework
Basic steps and code of Mybatis framework
1.ji create the required database
2. Configure the global configuration file mybatis ﹤ config.xml (other file names are preferred)
<?xml version="1.0" encoding="UTF-8"?>
...
Posted by petrosa on Thu, 24 Oct 2019 07:01:50 -0700
mybatis and springboot integration
mavne file:
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId ...
Posted by agoe on Wed, 23 Oct 2019 10:35:32 -0700
Mybatis source code initialization of mybatis
The initialization of Mybatis is completed by SqlSessionFactoryBuilder. The main work is to parse the XML file, encapsulate the parsed class contents into the Configuration class, and finally encapsulate the Configuration class into SqlSessionFactory and return it. Since then, the initialization is completed.
Three classes, XMLConfigBuilder, XM ...
Posted by zigojacko on Tue, 22 Oct 2019 06:03:10 -0700
MyBatis mapping file related operations
I. MyBatis mapping file
1, introduction
The real power of MyBatis lies in its mapping statement and its magic. Because of its extraordinary power, the XML file of mapper is relatively simple. If you compare it with JDBC code with the same function, you will immediately find that nearly 95% of the code is saved. MyBatis is built for SQL and is ...
Posted by literom on Mon, 21 Oct 2019 00:45:11 -0700