In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the example analysis of the SSM framework Mybatis. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Mybatis
Mybatis has two configuration files: mapping file (mapper.xml) and main configuration file (mybatis.xml)
Mapping file:
Connect the class to the database, write sql statements to complete the mapping
Insert into student (name,age,score) values (# {name}, # {age}, # {score})
Master profile:
Configure transaction management:
Data source (connecting to database): and age > # {age}
Where tag splicing replaces if
Select id,name,age,score from student and name like "# {name}"and age > # {age}"
(3) Association relation query
The query involves multiple tables
Delayed loading
(4) query cache
Improve query efficiency by not querying the results from the database every time
(5) annotated development
Replace the mapping file mapper.xml
@ Insert (value = {"insert into student (name,age,score) values (# {name}, # {age}, # {score})"}) void insertStudent (Student student); summary:
Register the mapping file through the Mapper interface (bulk load)
The Mapper interface must have the same name as the Mapper.xml file and be in the same package, that is, the namespace in the Mapper.xml file is the full class name of the Mapper interface.
The method name in the Mapper interface is the same as the id defined in the Mapper.xml file
The input parameter type of Mapper API should be the same as the parameterType defined in Mapper.xml.
The data type returned by the Mapper API should be the same as the resultType defined in Mapper.xml.
Mapper.xml
MyBatis.xml
This is the end of the sample analysis of the SSM framework Mybatis. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.