Mybatis _ Entry Program, mybatis Entry Program
Mybatis entry (1), program environment 1, jar package
2. Create SqlMapConfig. xml in the classpath directory.
Mybatis configuration file. All settings are as follows:
In addition, database parameters can be separated by properties files. The properties file is db. properties.
To differentiate directories. Create a new source folder (config) to place the configuration file. The two files are as follows.
SqlMapConfig. xml header
<? Xml version ="1.0"Encoding =UTF-8"?>
<! DOCTYPE configuration
PUBLIC "-// mybatis.org//DTD Config 3.0 // EN"
Http://mybatis.org/dtd/mybatis-3-config.dtd>
3. mapper. xml file (User. xml)
Some CURD statements.
4. Add mapper. xml to SqlMapConfig. xml
For example, mappers label in 2.
5. Logging
Allows you to conveniently view the running status.
(2) test procedures and program structure 1. Entry-level procedures
2. directory structure
(3) Summary
Create a mybatis environment using the configuration file. Then, you can use SqlSession to operate statement. (SQL statement in xml file)
Partial select
Update
Insert
Delete