In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what is the working principle of MyBatis", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the working principle of MyBatis" this article?
The working principle of MyBatis is as follows
1) read the MyBatis configuration file: mybatis-config.xml is the global configuration file of MyBatis and configures the running environment of MyBatis, such as database connection information.
2) load the mapping file. The mapping file is the SQL mapping file, which is configured with SQL statements to operate the database and needs to be loaded in the MyBatis configuration file mybatis-config.xml. Mybatis-config.xml files can load multiple mapping files, each corresponding to a table in the database.
3) construct a session factory: build a session factory SqlSessionFactory through configuration information such as the environment of MyBatis.
4) create a session object: a SqlSession object is created by the session factory, which contains all the methods for executing SQL statements.
5) Executor executor: the underlying MyBatis defines an Executor interface to operate the database, which will dynamically generate SQL statements that need to be executed according to the parameters passed by SqlSession, and is responsible for the maintenance of the query cache.
6) MappedStatement object: in the execution method of Executor API, there is a parameter of type MappedStatement, which encapsulates the mapping information and is used to store the id, parameters and other information of the SQL statement to be mapped.
7) input parameter mapping: input parameter types can be Map, List and other collection types, basic data types and POJO types. The input parameter mapping process is similar to the process that JDBC sets parameters on a preparedStatement object.
8) output result mapping: the output result type can be Map, List and other collection types, as well as basic data types and POJO types. The mapping process of the output result is similar to the parsing process of the result set by JDBC.
The above is all the contents of the article "how MyBatis works". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.