MyBatis-- core components: SqlSessionFactoryBuilder, SqlSessionFactory, SqlSession and SQL Mapper

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/cold___play/article/details/102746806

Core components

MyBatis core assembly divided into four parts.

  1. The SqlSessionFactoryBuilder (constructor): it generates a configuration SqlSessionFactory or code, using the stepwise constructed Builder mode.
  2. A SqlSessionFactory (factory interface): rely on it to generate SqlSession, using the factory model.
  3. SqlSession (session): either send a SQL execution returns results, you can also get Mapper interface. In the prior art, in general, we will make the business logic code of "disappeared" while using SQL Mapper interface programming technology MyBatis provides, it can improve the readability and maintainability of the code.
  4. SQL Mapper (mapper): components that are present MyBatis new design, which consists of a Java interface and an XML file (or notes), and the need to give the corresponding SQL mapping rules. It is responsible for sending SQL to perform, and returns the result.


Note that both the mapper or SqlSession can be sent to the database SQL execution, use the following components of learning.

Guess you like

Origin blog.csdn.net/cold___play/article/details/102746806