Build MyBatis operation database

 

1. Download the MyBatis compressed package https://github.com/mybatis/mybatis-3/releases and select the appropriate version of MyBatis

  

  Unzip it to the specified directory, as follows:

  

2. Create the form student

  

  Create entity class

  

  Create an interface

  

3. Create the mapping file studentMapper.xml under the Dao package, and create the configuration file MyBatis.xml under the src folder

  

  Open studentMapper.xml, find the mybatis-3.3.0.pdf file in the downloaded MyBatis compressed package, and introduce the corresponding constraints

    

 

  In the mapper mapping, directly write the sql statement namespace must have a value, the #{} braces must be consistent with the attribute name in the student entity class

  

  Open mybatis.xml, find the mybatis-3.3.0.pdf file in the downloaded MyBatis compressed package, introduce the corresponding constraints and

  

  Configure the mybatis.xml core configuration file

  

4. Implement the studentDao interface

  

5. Test

  

                                                      Remember 2018.4.22 morning

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324612185&siteId=291194637