Mybatis - what is Mybatis

Mybatis official website: https://mybatis.org/mybatis-3/index.html

Mybatis URL of github: https://github.com/mybatis/mybatis-3

Chinese document: https://mybatis.org/mybatis-3/zh/index.html

Maven repository address: https://mvnrepository.com/search?q=Mybatis

1 Introduction

1.1 What is Mybatis

insert image description here
● Mybatis is an excellent persistence layer framework
● It supports custom SQL, stored procedures and advanced mapping
● Mybatis avoids almost all JDBC code and manually setting parameters and getting result sets
● Mybatis can be configured using simple XML or annotations and mapping primitive types, interfaces and Java POJOs to records in the database

1.2 How to get Mybatis

● maven repository

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.5.3</version>
</dependency>

1.3 Endurance

Data Persistence
● Persistence is the process of transforming program data in persistent state and transient state
● Memory: Lost after power failure —instantaneous state
● Database (jdbc), io file—persistence

Why do you need persistence?

● Memory has the property of being lost when power is turned off , but we cannot lose some objects (such as the amount of money, user information), so we need to store it persistently and take it out when it is used
● Memory is too expensive

1.4 Persistence Layer

Dao layer, Service layer, Controller layer...
● The code block that completes the persistence work
● The layer is very clearly demarcated

1.5 Why do you need Mybatis

● Help programmers store data into the database
● Convenience
● Traditional JDBC code is too complicated, simplify and frame.
It is also possible without Mybatis, it is easier to use, and the technology is         not         high         or         low         .         Provides object - relational mapping tags, supports object-relationship building and maintenance








Guess you like

Origin blog.csdn.net/Silly011/article/details/123941180