1. Introduction

1.1 What is Mybatis

  • MyBatis is an excellent persistence layer framework.
  • It supports custom SQL, stored procedures, and advanced mapping.
  • MyBatis eliminates almost all of the JDBC code and the work of setting parameters and fetching result sets.
  • MyBatis can configure and map primitive types, interfaces, and Java POJOs (Plain Old Java Objects) to records in the database via simple XML or annotations.

How do I get Mybatis?

  • Maven repositories
<! -- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.5.7</version>
</dependency>
Copy the code
  • English: mybatis.org/mybatis-3/z…

1.2 the persistence layer

Data persistence

  • Persistence is the process of converting program data into persistent and transient states
  • Memory: lost when power is off
  • Database (JDBC), IO file persistence
  • Life: refrigerated, canned

Why persistence?

  • There are some things he can’t let go
  • Memory is too expensive

1.3 the persistence layer

Dao layer, Service layer, Controller layer