Generating SQL using Mybatis-gen

Source: Internet
Author: User

I.. config.properties file

 #数据库连接 
Jdbc.driver=com.mysql.jdbc.driverjdbc.url =jdbc:mysql:// 127.0.0.1:3306/TEST?USEUNICODE=TRUE&CHARACTERENCODING=GBK Jdbc.user=rootjdbc.password =1234
# Build the package name of the model Target.model. package =test.entitytarget.sql. package =test.mappingtarget.client. package =srctarget.sql.project =srctarget.client.project =src
#生成sql中可自动生成日期gmt. Create =f_create_timegmt.modified =f_modify_time

Ii.. config

<?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>    <PropertiesResource= "Config.properties" />    <Classpathentry Location= "Mysql-connector-java-5.1.26.jar" />    <ContextID= "DB"Targetruntime= "MyBatis3">        <Commentgenerator>            < Propertyname= "Suppressdate"value= "true"/>                           < Propertyname= "Suppressallcomments"value= "true" />        </Commentgenerator>        <jdbcconnectionDriverclass= "${jdbc.driver}"Connectionurl= "${jdbc.url}"userId= "${jdbc.user}"Password= "${jdbc.password}">        </jdbcconnection>        <Javatyperesolver>            < Propertyname= "Forcebigdecimals"value= "false" />        </Javatyperesolver>        <JavamodelgeneratorTargetpackage= "${target.model.package}"Targetproject= "${target.model.project}">            < Propertyname= "Enablesubpackages"value= "true" />            < Propertyname= "Trimstrings"value= "true" />        </Javamodelgenerator>        <SqlmapgeneratorTargetpackage= "${target.sql.package}"Targetproject= "${target.sql.project}">            < Propertyname= "Enablesubpackages"value= "true" />        </Sqlmapgenerator>        <Javaclientgeneratortype= "Xmlmapper"Targetpackage= "${target.client.package}"Targetproject= "${target.client.project}">            < Propertyname= "Enablesubpackages"value= "true" />        </Javaclientgenerator>        <!--Add your table below -    <TableTableName= "T_external_bank_card_replace_log"Domainobjectname= "Externalbankcardreplacelog"/>        </Context></generatorconfiguration>

Third, Gen.bat

/F/S/-CP.; mybatis-generator-core-1.3. 2. Jar org.mybatis.generator.api.shellrunner-configfile config-overwritepause@echo on

Iv. Download the jar package

Mybatis-generator-core-1.3.2.jar

Mysql-connector-java-5.1.26.jar

Five, the implementation of Gen.bat, you can

Generating SQL using Mybatis-gen

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.