MyBatis Code generation tool Mybatis-generator for use in Myeclipse10

Source: Internet
Author: User
Tags generator set time

A. Create a new Myplugin directory under the MyEclipse installation directory, as shown in:

B. Place the files inside the mybatis.zip in the Dropins directory of MyEclipse, as shown:

C. Under MyEclipse installation directory Dropins, create a new Mybatis.link file and indicate the path to the Mybatis-generator placement in the file:

Iv. introduce the Mysql-connector-java-5.1.23.jar and other jar packages required by mybatis into the project;

V. Put the generatorconfig.xml file in the project and make the corresponding changes:

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE generatorconfiguration Public "-//mybatis.org//dtd mybatis Generator Configuration 1.0//en" "Http://mybati S.org/dtd/mybatis-generator-config_1_0.dtd "><!--This file is only mybatis the database automatically generated mapping files, entity classes, interfaces and other methods, when published, do not submit this file, can also be deleted -<generatorconfiguration>    <!--The classpath of the referenced JDBC, where the JDBC jar and generator jar packages are put together -    <Classpathentry Location= "D:\Workspaces\dayhrlib\mysql-connector-java-5.1.23.jar"/>    <ContextID= "Context1"Targetruntime= "Mybatis3simple">                <Commentgenerator>            <!--whether to remove automatically generated comments true: Yes: false: No -            < Propertyname= "Suppressallcomments"value= "false"/>            < Propertyname= "Suppressdate"value= "true" /> <!--whether to generate an annotation generation timestamp -            </Commentgenerator>                <!--The connection information for the specified JDBC -        <jdbcconnectionDriverclass= "Com.mysql.jdbc.Driver"Connectionurl= "jdbc:mysql://172.1.1.200:3306/Your database name"userId= "root"Password= "root" />                <!--Type Conversions -          <Javatyperesolver>              <!--whether to use BigDecimal, false to automatically convert the following types (Long, Integer, short, etc.) -              < Propertyname= "Forcebigdecimals"value= "false"/>          </Javatyperesolver>                  <!--generate entity class address Model -               <JavamodelgeneratorTargetpackage= "Com.dayhr.web.module.hr.sm.salary.model"Targetproject= "Dayhr_app\src" >            <!--whether to add a new layer of Schema,eg:fase path under the current path Com.oop.eksp.user.model, True:com.oop.eksp.user.model. [SchemaName] -              < Propertyname= "Enablesubpackages"value= "false"/>              <!--whether to make a trim call to a field of type string at set time -              < Propertyname= "Trimstrings"value= "true"/>          </Javamodelgenerator>                <!--generate Map.xml file XML -             <SqlmapgeneratorTargetpackage= "Com.dayhr.web.module.hr.sm.salary.mapper"Targetproject= "Dayhr_app\src" >            <!--whether to add a new layer of Schema,eg:fase path under the current path Com.oop.eksp.user.model, True:com.oop.eksp.user.model. [SchemaName] -              < Propertyname= "Enablesubpackages"value= "false" />         </Sqlmapgenerator>                <!--generate map.xml corresponding to the client, which is the interface DAO -          <JavaclientgeneratorTargetpackage= "Com.dayhr.web.module.hr.sm.salary.mapper"Targetproject= "Dayhr_app\src"type= "Xmlmapper" >            <!--whether to add a new layer of Schema,eg:fase path under the current path Com.oop.eksp.user.model, True:com.oop.eksp.user.model. [SchemaName] -              < Propertyname= "Enablesubpackages"value= "false" />         </Javaclientgenerator>                <!--Schema: Database name tableName: corresponding database table Domainobjectname: The entity class to be generated Enable*byexamp Le: Whether to generate the example class -         <TableSchema= "dayhr_db"TableName= "T_hr_sm_salschemabase"Domainobjectname= "Salschemabase"Enablecountbyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Enableupdatebyexample= "false">                        <!--Ignore column, do not generate bean field -              <Ignorecolumncolumn= "FRED" />              <!--specifying the Java data type for a column -              <Columnoverridecolumn= "Long_varchar_field"Jdbctype= "VARCHAR" />         </Table>            </Context></generatorconfiguration>

Six, restart MyEclipse, right-click the Generatorconfig.xml file, in the pop-up menu select Generate Mybatis/ibatis artifacts to generate the required files:

MyBatis Code generation tool Mybatis-generator for use in Myeclipse10

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.