All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.generatorConfigForOracle.xml Maven / Gradle / Ivy

<?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">

<!-- 参考官方文档
http://www.mybatis.org/generator/configreference/xmlconfig.html
http://generator.sturgeon.mopaas.com/index.html
http://mbg.cndocs.tk/
-->
<generatorConfiguration>

    <!-- 指定数据连接驱动jar地址 -->
    <classPathEntry location="F:\Documents\IDEA\repository\com\oracle\ojdbc14\10.2.0.4.0\ojdbc14-10.2.0.4.0.jar"/>

    <!-- 一个数据库一个context -->
    <context id="testTables" targetRuntime="MyBatis3">
        <!-- 自动识别数据库关键字,默认false,如果设置为true,根据SqlReservedWords中定义的关键字列表;
        一般保留默认值,遇到数据库关键字(Java关键字),使用columnOverride覆盖
        -->
        <property name="autoDelimitKeywords" value="false"/>
        <!-- 生成的Java文件的编码 -->
        <property name="javaFileEncoding" value="UTF-8"/>
        <!-- 格式化java代码 -->
        <property name="javaFormatter" value="org.mybatis.generator.api.dom.DefaultJavaFormatter"/>
        <!-- 格式化XML代码 -->
        <property name="xmlFormatter" value="org.mybatis.generator.api.dom.DefaultXmlFormatter"/>

        <!--开启抑制类型的警告信息-->
        <property name="suppressTypeWarnings" value="true"/>

        <!-- 插件 :其他插件参考http://www.jianshu.com/p/1b826d43dbaf-->
        <!--插件 :用来给Java模型生成equals和hashcode方法-->
        <!--<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>-->
        <!--插件 :用来为生成的Java模型类添加序列化接口-->
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
        <!--插件 :生成的Java模型创建一个toString方法-->
        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
        <!--<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">-->
        <!--<property name="searchString" value="Example$"/>-->
        <!--<property name="replaceString" value="Criteria"/>-->
        <!--</plugin>-->

        <!-- 注释 -->
        <commentGenerator>
            <!-- 是否去除自动生成的注释 true:是 : false:否 -->
            <property name="suppressAllComments" value="false"/>
            <!-- 是否给实体类生成的备注的注释 true:是 : 默认为false:否 -->
            <property name="addRemarkComments" value="true"/>
            <!-- 是否去掉注释代时间戳 true:是 : false:否,默认yyyy-MM-dd HH:mm:ss(1.3.5-chinese-annotation修改版)-->
            <property name="suppressDate" value="false"/>
            <property name="dateFormat" value="yyyy/MM/dd HH:mm"/>
        </commentGenerator>

        <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
        <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
                        connectionURL="jdbc:oracle:thin:@11.11.11.38:1521:orcl"
                        userId="wifi_city"
                        password="city">
        </jdbcConnection>

        <!-- 类型转换 -->
        <javaTypeResolver>
            <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
                NUMERIC 类型解析为java.math.BigDecimal -->
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>

        <!--  model的配置  -->
        <javaModelGenerator targetPackage="com.cmcc.base12582.service.esblog.model"
                            targetProject="src\main\java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!--mybatis的xml的配置  -->
        <sqlMapGenerator targetPackage="mapper"
                         targetProject="src\main\resources\mybatis">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>

        <!--mapper的配置  -->
        <javaClientGenerator type="XMLMAPPER"
                             targetPackage="com.cmcc.base12582.service.esblog.mapper"
                             targetProject="src\main\java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>


        <!-- 对于mybatis来说,即生成Mapper接口,注意,如果没有配置该元素,那么默认不会生成Mapper接口
           targetPackage/targetProject:同javaModelGenerator
           type:选择怎么生成mapper接口(在MyBatis3/MyBatis3Simple下):
               1,ANNOTATEDMAPPER:会生成使用Mapper接口+Annotation的方式创建(SQL生成在annotation中),不会生成对应的XML;
               2,MIXEDMAPPER:使用混合配置,会生成Mapper接口,并适当添加合适的Annotation,但是XML会生成在XML中;
               3,XMLMAPPER:会生成Mapper接口,接口完全依赖XML;
           注意,如果context是MyBatis3Simple:只支持ANNOTATEDMAPPER和XMLMAPPER
       -->


        <!-- 指定生成的数据库表 -->
        <!-- domainObjectName:指定生成的实体类的文件名 -->
        <table tableName="ESB_LOG_CONFIGURATION" domainObjectName="EsbLogConfigurationEntity"/>
        <!--<table tableName="APP_CRASH_LOG" domainObjectName="AppCrashLogEntity"/>-->
        <!--<table tableName="APP_METHOD_TIME_LOG_201610" domainObjectName="AppMethETHODTimeLogEntity"/>-->
        <!--<table tableName="APP_PAGE_RENDER_LOG_201610" domainObjectName="AppPageRenderLogEntity"/>-->
        <!--<table tableName="H5_PAGE_RENDER_LOG_201610" domainObjectName="H5PageRenderLogEntity"/>-->


        <!-- 其他需求:有些表的字段需要指定java类型 -->
        <!--<table schema="management_system" tableName="s_user"-->
        <!--domainObjectName="UserEntity" enableCountByExample="false"-->
        <!--enableDeleteByExample="false" enableSelectByExample="false"-->
        <!--enableUpdateByExample="false">-->
        <!--&lt;!&ndash; schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample-->
        <!--是否生成 example类   &ndash;&gt;-->
        <!--&lt;!&ndash; 忽略列,不生成bean 字段 &ndash;&gt;-->
        <!--<ignoreColumn column="FRED" />-->
        <!--&lt;!&ndash; 指定列的java数据类型 &ndash;&gt;-->
        <!--<columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />-->
        <!--</table>-->

    </context>

</generatorConfiguration>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy