MyBatis-GENARATOR reverse project implementation specific steps
generatorConfig.xml
mybatis-generator-core-1.3.2.jar
mysql-connector-java-5.1.7-bin.jar
The above three files are placed on the SRC in the project directory after running the command after F5 refresh
generatorConfig.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<! Doctype GeneratorConfiguration
Public "-// mybatis.org/dtd mybatis generator configuration 1.0 // en"
"http://myBatis.org/dtd/myBatis- Generator- config_1_0.dtd">
<GeneratorConfiguration>
<!-Database driver->
<classpathentry location = "mysql-confor-java-5.1.7-bin.jar"/>
<context id = "db2tables" targetruntime = "mybatis3">
<Commentgenrator>
<property name = "support" value = "true"/>
<!-Whether to remove automatic generating comments True: Yes: false: No->
<propoperty name = "supportComments" value = "true"/>
</Commentgenrator>
<!-Database link URL, username, password->
<jdbcconnection driveclass = "com.mysql.jdbc.driver" connectionURL = "jdbc: mysql: //127.0.0.1/gaokao" userid = "root" password = "root">
</jdbcconnection>
<javatyperSolver>
<property name = "Forcebigdecimals" value = "false"/>
</javatyperesolver>
<!-Generate the package name and location of the model->
<javamodELGENATOR TARGETPACKAGE = "com.ma.model" targetProject = "src \ main \ java">
<property name = "enablesubpackages" value = "true"/>
<propoperty name = "trimstrings" value = "true"/>
</javamodelgenrator>
<!-Generate the package name and location of the mapping file->
<sqlmapgenrator targetPackage = "com.ma.mapping" targetproject = "src \ main \ java">
<property name = "enablesubpackages" value = "true"/>
</sqlmapgenrator>
<!-Generate the package name and location of DAO->
<javaclientGenerator type = "xmlmapper" targetPackage = "com.ma.Dao" targetproject = "src \ main \ java">
<property name = "enablesubpackages" value = "true"/>
</javaclientGenerator>
<!-The table tableename to generate the name or view name of the database Dom ArinObjectName is the physical class name->
</context>
</GeneratorConfiguration>
TARGETPROJECT is written that the relative path may not be added in front of the project name.
Open the console project in Eclipse right-click-> Show in —> Terminal
When the above is completed, you only need to open the console, enter and and andThe three files added in the first stepIn the same level, execute scripts
Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml –overwrite
Try to remove –OverWrite:Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml
appears below, it is successful