Introduction to mybatis_ Power node Java college sorting
In this paper, we share the introduction learning materials of mybatis for your reference. The specific contents are as follows
Other tools or technologies needed: project management tool: Maven test run tool: JUnit database: Derby
No more nonsense, direct code Maven dependencies:
SQL table creation and data insertion:
Mybatis configuration file: Test mybatis configuration. In the Src / main / resource source directory xml
UserMapper. XML mapper file (under Src / main / Java / com.freud.practice directory)
User. Java object class (under Src / main / Java / com.freud.practice directory)
UserMapper. Java mapper class (under Src / main / Java / com.freud.practice directory)
Test class testmybatis Java (under Src / test / Java / com. Freud. Practice directory)
The above is an introduction to using XML as mapper configuration file. In fact, mybatis also supports annotation. The specific operations are as follows:
1. Open usermapper Comments in Java. 2. Open test mybatis configuration XML and comment out the existing mapper 3 Delete usermapper XML file
This is the mapper configuration of mybatis's annotation mode. I prefer XML, so the subsequent tutorials will be written in the way of XML configuration.
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.