MyBatis code generator (plugin)
--Install the plugin:
1. Unzip the Mybatis_generator_1.3.1.zip file
2. Copy the Features,pougins folder to the C:\Users\chufeng\MyEclipse\MyEclipse10\soft\mybatis directory (C:\Users\pc_name\MyEclipse\ MyEclipse 10\ for myeclipse installation directory, soft\mybaits can create it yourself)
3. Go to the C:\Users\chufeng\MyEclipse\MyEclipse10\dropins directory and create a new Mybatis.link file, add the content: path=c:\\users\\pc_name\\myeclipse\\ MyEclipse 10\\soft\\mybatis
4. Start MyEclipse
--Using plugins
5. Add the Generatorconfig.xml file to the project and modify the relevant content. Right build can find generator MyBatis artifacts generated
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><!--<properties Resource= "Conn.properties"/>---<classpathentry location= "E:\tools\lib\mysql_driver\ Mysql-connector-java-5.1.26-bin.jar "/><!--specifies that the runtime is MYBATIS3 version--><context id=" Testtables " Targetruntime= "MyBatis3" ><commentGenerator><!--whether to uncomment--><property name= "Suppressallcomments" Value= "true"/> <!--generate comment generation timestamp--><property name= "Suppressdate" value= "true"/></commentgenerator ><!--JDBC Connection information--><jdbcconnection driverclass= "Com.mysql.jdbc.Driver" connectionurl= "jdbc:mysql:// Localhost:3306/scm?useunicode=true&characterencoding=utf-8 "userid=" root "password=" root "></ jdbcconnection> <!--Targetpackage Specify the model in which package is generated, Targetproject specify the project's SRC,--> <javamodelgenerator targetpackage= "cn.buaa.scm.entity" targetproject= "scm/src" ><!--remove space before and after fields-->< Property Name= "Trimstrings" value= "false"/></javamodelgenerator><!--configuration SQL Map file generation information-->< Sqlmapgenerator targetpackage= "Cn.buaa.scm.dao" targetproject= "SCM/SRC"/><!--Configure DAO interface generation information-->< Javaclientgenerator type= "Xmlmapper" targetpackage= "Cn.buaa.scm.dao" targetproject= "SCM/SRC"/><table Tablename= "Account" domainobjectname= "account"/><table tablename= "Supplier" domainobjectname= "Supplier"/ ></context></generatorConfiguration>
Note: After completion, remember to implement the entity serializable, rewrite the ToString () method, easy to use later
Installation of the Mybatis_generator tool---mybatis code generator (plug-in)--mybatis reverse engineering generation model and XML and DAO