Mybatis multi table query one to many
There are several relationships between tables:
One to many
Many to one
one-on-one
Many to many
give an example:
Users and orders are one to many
Orders and users are many to one
One user can place multiple orders
Multiple orders belong to the same user
The ID number is one to one.
A person can only have one ID number.
An ID nu ...
Added by imamferianto on Thu, 04 Nov 2021 03:23:00 +0200
For SSM integration, a Cannot resolve reference to bean 'com.mysql.cj.jdbc.Driver' or No bean named 'database driven full class name' solution appears
After building a complete SSM framework, I test the addition, deletion, modification and query of the database in the test class. The following is the test code:
@Test
public void insert() {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
EmployeeMapper employeeMappe ...
Added by pngtest on Mon, 01 Nov 2021 12:50:31 +0200
4. Analysis of L2 cache source code
1, L2 cache configuration
brief introduction
The L2 cache is built on the L1 cache. When receiving a query request, MyBatis will first query the L2 cache. If the L2 cache is not alive
In, query the first level cache again. If the first level cache does not exist, query the database again.
graph LR
A (L2 cache) - > b (L1 cache) - > C (dat ...
Added by pyrodude on Sat, 30 Oct 2021 20:25:07 +0300
Getting started with MyBatis framework
catalogue
1. Framework overview
1.1 three tier architecture
1.2 framework
2. Overview of mybatis framework
2.1 JDBC defects
2.2 overview of mybatis framework
3. Introduction case of mybatis
4. Introduction to main classes in mybatis
4.1 Resources class
4.2 SqlSessionFactoryBuilder class
4.3 SqlSessionFactory interface
4.4 SqlSession ...
Added by rockyracoon on Tue, 26 Oct 2021 10:51:26 +0300
MyBatis study notes_ day02 L2 cache principle
L2 cache principle
1. L2 cache
1.1 definitions
L2 cache is also called application level cache. Different from L1 cache, its scope is the whole application and can be used across threads. Therefore, L2 cache has a higher hit rate and is suitable for caching some data with less modification.
When it comes to L2 cache, let's briefly talk ...
Added by eideticmnemonic on Sun, 24 Oct 2021 14:22:20 +0300
The first Mybatis program for basic Mybatis learning
Preface:
Hello, ladies and gentlemen, I'm running like a snail rz. Of course you can call me Snail Jun. I'm a beginner who has studied Java for more than half a year. At the same time, I have a great dream that I will become an excellent Java architect one day. This Mybatis Basic Learning series is used to record the whole process of my lea ...
Added by kra on Mon, 18 Oct 2021 19:23:45 +0300
[SSM] Spring + Spring MVC + Mybatis integration
1. Environmental construction
1.1 database files
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id Primary key',
`username` varchar(20) CHARACTER SET ...
Added by alex57 on Thu, 14 Oct 2021 22:57:57 +0300
[learning notes] MyBatis learning notes
This paper is a dynamic node MyBatis tutorial My study notes.
Chapter I
1. Three tier architecture
(1) Functions of three layers
User Interface Layer: accepts user data and displays the processing results of requests, including jsp, html, servlet, etc. Corresponding controller package; Business Logic Layer: accept the data passed from the ...
Added by hazy on Tue, 12 Oct 2021 10:26:43 +0300
Review MyBatis process
In the first article, we simply wrote and ran a general process of querying a certain data in the database. Now let's study the operation process of MyBatis. How does it run?
Operation process
1. Detailed flow of code in test class
We all know that the entry of a program in Java is the main fu ...
Added by himnbandit on Tue, 05 Oct 2021 01:32:17 +0300
select, update, delete, insert tags of mybatis XML mapper
3. XML mapper
Create tables: user, shopping cart, goods
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods` (
`good_id` int(11) NOT NULL AUTO_INCREMENT,
`good_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`good_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
-- ----------------------------
-- R ...
Added by ledtear on Sun, 03 Oct 2021 22:18:17 +0300