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> < ;! --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