Automatic generation of DAO, model, mapper layer with Mybatis-generator

Source: Internet
Author: User

Generator properties:

# database-driven jar path drive.class.path=e:\\develop_softs\\.m2\\repository\\mysql\\mysql-connector-java\\5.1.30\\ mysql-connector-java-5.1.30.jar# Database Connection Parameters jdbc.driver=com.mysql.jdbc.driverjdbc.url=jdbc:mysql://localhost:3306/ quick4j?useunicode=true&characterencoding=utf-8jdbc.username=rootjdbc.password=admin123# Package Path Configuration Model.package =com.eliteams.quick4j.web.modeldao.package=com.eliteams.quick4j.web.daoxml.mapper.package= Com.eliteams.quick4j.web.daotarget.project=src/main/java



Genratorconfig:

<?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 "><!--Configure the Run as Maven build:goals parameter: mybatis-generator: Generate-dmybatis.generator.overwrite=true--><!--configuration tableName, use the Run as Maven build to generate the DAO model layer--><gene Ratorconfiguration> <!--profile path--<properties url= "${mybatis.generator.generatorconfig.properties}"/&    Gt <!--database driver package path--<classpathentry location= "${drive.class.path}"/> <context id= "Db2tables" Targetrunti Me= "MyBatis3" > <!--Close comments-<commentGenerator> <property name= "Suppressallcomme NTS "value=" true "/> </commentGenerator> <!--database connection information--<jdbcconnection Driverclass = "${jdbc.driver}" connectionurl= "${jdbc.url}" userid= "${jdbc.username}" PASSWOrd= "${jdbc.password}" > </jdbcConnection> <!--generated model package path--<javamodelgenerator Targetpackage= "${model.package}" targetproject= "${target.project}" > <property name= "enableSubPackages" va Lue= "Ture"/> <property name= "trimstrings" value= "true"/> </javaModelGenerator> &lt ;! --Generate XML Mapper file path--<sqlmapgenerator targetpackage= "${xml.mapper.package}" targetproject= "${target.projec T} "> <property name=" enablesubpackages "value=" ture "/> </sqlMapGenerator> <!-- Generated DAO interface package path--<javaclientgenerator type= "Xmlmapper" targetpackage= "${dao.package}" targetproject= "${targe        T.project} "> <property name=" enablesubpackages "value=" ture "/> </javaClientGenerator> <!--corresponding database table name--<table tablename= "" > </table> </context></generatorconfigu Ration>





Automatic generation of DAO, model, mapper layer with Mybatis-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.