GeneratorConfig.xml

Posted zygyun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GeneratorConfig.xml相关的知识,希望对你有一定的参考价值。

<?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>
    <!--数据库驱动-->
    <classPathEntry  location="C:/Users/admin/.m2/repository/mysql/mysql-connector-java/5.1.46/mysql-connector-java-5.1.46.jar"/>

    <context id="myBatis3"  targetRuntime="MyBatis3">
        <property name="mergeable" value="true" />
        <property name="javaFileEncoding" value="UTF-8" />

        <commentGenerator>
            <property name="suppressDate" value="true"/>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>

        <!--数据库链接地址账号密码-->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://192.168.1.10:3306/test_zyg?characterEncoding=utf8" userId="root" password="root">
        </jdbcConnection>
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>

        <!--生成Model类存放位置-->
        <javaModelGenerator targetPackage="com.zyg.model" targetProject="demo-mybatis/src/main/java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!--生成映射文件存放位置-->
        <sqlMapGenerator targetPackage="com.zyg.dao" targetProject="demo-mybatis/src/main/java">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>

        <!--生成Dao类存放位置-->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.zyg.dao" 
            targetProject="demo-mybatis/src/main/java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

        <!--生成对应表及类名-->
        <table tableName="emp" domainObjectName="Emp" enableCountByExample="false"
               enableUpdateByExample="false" enableDeleteByExample="false"
               enableSelectByExample="false" selectByExampleQueryId="false">
        </table>
    </context>
</generatorConfiguration>

 

以上是关于GeneratorConfig.xml的主要内容,如果未能解决你的问题,请参考以下文章

mybatis generator的generatorConfig.xml配置详解

GeneratorConfig.xml

generatorConfig.xml使用

怎么解决mybatis自动生成generatorConfig.xml出现xml的错误的问题?

generatorconfig.xml有外键怎么设置

mybatis generatorConfig.xml 自动生成