Study notes: MyBatis summary

(1). The overall process of MyBatis

MyBatis is an open source data persistence layer framework, which internally encapsulates the operation of accessing the database through JDBC, supports common SQL queries, stored procedures and advanced mapping, and almost eliminates all manual settings of JDBC codes and parameters and retrieval of result sets . As a persistence layer framework, MyBatis' main idea is to strip out a large number of SQL statements in the program and configure them in the configuration file to realize the flexible configuration of SQL. The advantage of this is that SQL is separated from program code, and SQL can be directly modified in the configuration file without modifying program code. Mybatis performs configuration and original mapping through simple XML or annotations, and establishes a mapping relationship between entity classes and SQL statements.
insert image description here(2). MyBatis core interface and class
insert image description here1) Each MyBatis application takes an instance of the SqlSessionFactory object as the core.

2) First obtain the SqlSessionFactoryBuilder object, which can be constructed according to the XML configuration file or the instance of the Configuration class.

3) Then get the SqlSessionFactory object, which can be obtained through the SqlSessionFactoryBuilder object.

4) Use the SqlSessionFactory object to get the SqlSession instance.

Guess you like

Origin blog.csdn.net/qq_45349018/article/details/104912610