Use Mybatis alone

1. Import package mybatis       

 (If you do not you can create your own package lib)

 (Right-click to select all packages Add as Libray ...)

 

 

 (Src folder, create a log4j.properties)

 

2. The establishment of a database and tables

 

 

 

 

 

3. The establishment of the entity class

 (New Folder main -> Creating Food category)

 

4. Establish Mapper Interface

 

5. Establish sql mapping file

 (Create config -> mapper -> FoodMapper .id fourth step of the method name is saveFood, parameterType input type: 'main.Food entity class path')

 

6. Establish sqlMapConfig.xml file

 (Create a src directory -> sqlMapConfig.xml)

 

7. Writing test class

 

 

 

 

Guess you like

Origin www.cnblogs.com/wnyzz/p/12105364.html