Generator.xml file:
<?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 Package location - <!--<classpathentry location= "D:\software\lib\mysql-connector-java-5.1.21.jar"/> - <Classpathentry Location= "C:\Users\xxx\.m2\repository\mysql\mysql-connector-java\5.1.30\mysql-connector-java-5.1.30.jar" /> <ContextID= "Db2tables"Targetruntime= "MyBatis3"> <Commentgenerator> < Propertyname= "Suppressallcomments"value= "true" /> </Commentgenerator> <!--database link URL, user name, password - <jdbcconnectionDriverclass= "Com.mysql.jdbc.Driver"Connectionurl= "Jdbc:mysql://192.168.31.xxx:3306/xxx"userId= "XXX"Password= "XXX"> <!--<jdbcconnection driverclass= "Oracle.jdbc.driver.OracleDriver" connectionurl= "Jdbc:oracle:thin: @localhost : 1521:orcl "userid=" MSA "password=" MSA > - </jdbcconnection> <Javatyperesolver> < Propertyname= "Forcebigdecimals"value= "false" /> </Javatyperesolver> <!--Build the package name and location of the model - <JavamodelgeneratorTargetpackage= "Zizai.model"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true" /> < Propertyname= "Trimstrings"value= "true" /> </Javamodelgenerator> <!--generated map file package name and location - <SqlmapgeneratorTargetpackage= "Zizai.mapping"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true" /> </Sqlmapgenerator> <!--generate DAO's package name and location - <Javaclientgeneratortype= "Xmlmapper"Targetpackage= "Zizai.dao"Targetproject= "src"> < Propertyname= "Enablesubpackages"value= "true" /> </Javaclientgenerator> <!--to generate those tables (change tablename and Domainobjectname) - <TableTableName= "image"Domainobjectname= "Image"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false" /> </Context></generatorconfiguration>
Enter CMD in the directory to enter the command prompt
Input: Java-jar mybatis-generator-core-1.3.2.jar-configfile generator.xml-overwrite
Appears successfully proof model,dao,mapping has been generated good
MyBatis generator.xml Configuration Auto-generated model,dao,mapping