Mybatis Generator Use

Source: Internet
Author: User

1) Download the MyBatis file as follows
Https://github.com/mybatis/generator/releases
2) Configure Mybatis-generator-core-1.3.2\lib under Generatorconfig.xml
<?XML version= "1.0" encoding= "UTF-8"?>  <!DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "Http://myba Tis.org/dtd/mybatis-generator-config_1_0.dtd ">  <generatorconfiguration>       <!--database-driven Jar package location (relative path)) -      <Classpathentry Location= "Mysql-connector-java-5.1.25-bin.jar"/>      <ContextID= "Db2tables"Targetruntime= "MyBatis3">          <Commentgenerator>              < Propertyname= "Suppressdate"value= "true"/>              < Whether a comment is generated!-- -              < Propertyname= "Suppressallcomments"value= "true"/>          </Commentgenerator>          <!--database link URL, user name, password -          <jdbcconnectionDriverclass= "Com.mysql.jdbc.Driver"Connectionurl= "Jdbc:mysql://127.0.0.1:3306/system"userId= "Admin"Password= "123456">          </jdbcconnection>          <Javatyperesolver>              < Propertyname= "Forcebigdecimals"value= "false"/>          </Javatyperesolver>          <!--generate the package name and location of the entity class -          <JavamodelgeneratorTargetpackage= "Com.hls.model"Targetproject= "src">              < Propertyname= "Enablesubpackages"value= "true"/>              < Propertyname= "Trimstrings"value= "true"/>          </Javamodelgenerator>          <!--Build the package name and location of the mapping file -          <SqlmapgeneratorTargetpackage= "Com.hls.mapping"Targetproject= "src">              < Propertyname= "Enablesubpackages"value= "true"/>          </Sqlmapgenerator>          <!--generate DAO's package name and location -          <Javaclientgeneratortype= "Xmlmapper"Targetpackage= "Com.hls.idao"Targetproject= "src">              < Propertyname= "Enablesubpackages"value= "true"/>          </Javaclientgenerator>          <!--the table TableName to be generated is the name of the table in the database Domainobjectname entity class name -          <TableTableName= "Sys_dict"Domainobjectname= "Dict"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    <TableTableName= "Sys_dict_data"Domainobjectname= "Dictdata"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    <TableTableName= "Sys_menu"Domainobjectname= "Menu"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    <TableTableName= "sys_org"Domainobjectname= "Org"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    <TableTableName= "Sys_role"Domainobjectname= "Role"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    <TableTableName= "Sys_user"Domainobjectname= "User"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false">    </Table>    </Context>  </generatorconfiguration>  

3) Open cmd to enter the Mybatis-generator-core-1.3.2\lib directory and run the command
Java-jar Mybatis-generator-core-1.3.2.jar-configfile Generatorconfig.xml-overwrite

4) Hint MyBatis Generator finished successfully, there were warnings. It worked.

Mybatis Generator Use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.