Automatically generate model mapper mapping files using generator

Source: Internet
Author: User

1. Download the package addresshttp://download.csdn.net/detail/u012909091/72060912. Download and unzip the file to any directory3. Delete all files under mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\src

4. Modify the configuration file Mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\generatorconfig.xml file<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE generatorconfigurationpublic "-//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-connector-java-5.1.25-bin.jar"/><context id= "DB2Tables" TargetRuntime= " MyBatis3 "><commentgenerator><property name=" Suppressdate "value=" true "/><!--whether to remove auto-generated comments true: Yes: False: No--><property name= "suppressallcomments" value= "true"/></commentgenerator><!--database link URL, User name, password--><jdbcconnection driverclass= "Com.mysql.jdbc.Driver" connectionurl="Jdbc:mysql://localhost:3306/generator" userid= "root" password= "249832" ></jdbcconnection><javatyperesolver><property name= "Forcebigdecimals" value= "false"/></ javatyperesolver><!--generate the package name and location of the model--><javamodelgenerator targetpackage= "test.domain" targetProject= "src "><property name=" Enablesubpackages "value=" true "/><property name=" Trimstrings "value=" true "/></ javamodelgenerator><!--generate the package name and location of the mapping file--><sqlmapgenerator targetpackage= "test.mapping" targetProject= " SRC "><property name=" Enablesubpackages "value=" true "/></sqlmapgenerator><!--generate DAO's package name and location-- <javaclientgenerator type= "Xmlmapper" targetpackage= "test. Idao "targetproject=" src "><property name=" Enablesubpackages "value=" true "/></javaclientgenerator> <!--the table TableName to be generated is the name of the table or view in the database Domainobjectname is the entity class name--><tabletablename= "test" domainobjectname= "test" enablecountbyexample= "false" enableupdatebyexample= "false" Enabledeletebyexample= "false" enableselectbyexample= "false" Selectbyexamplequeryid= "false" ></table> </context></generatorConfiguration>

5. Use CMD to enter your directory CD C:\USERS\FXL\DESKTOP\MYBATIS-GENERATOR-CORE-1.3.2\MYBATIS-GENERATOR-CORE-1.3.2\LIB\SRC

Input command Java-jar mybatis-generator-core-1.3.2.jar-configfile generatorconfig.xml-overwrite

6. Build completed to the Lib directory to find the specified file can be

Automatically generate model mapper mapping files using generator

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.