`

用Maven插件生成Mybatis代码

阅读更多
01 用Maven插件生成Mybatis代码
http://blog.csdn.net/gufeng672/article/details/27196347

02 generatorConfig.xml文件配置
http://stackoverflow.com/questions/32806225/mybatis-cannot-generator-using-oracle-database

03 MyBatis Generator官网
http://www.mybatis.org/generator/running/runningWithMaven.html

04 我的问题:classPathEntry的配置。以下是我的配置文件:
<?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">

<!-- 使用 mvn mybatis-generator:generate -->
<generatorConfiguration>
    <properties resource="jdbc.properties"/>
	<classPathEntry location="${maven.repository}\com\oracle\ojdbc6\11.2.0.1.0\ojdbc6-11.2.0.1.0.jar" />
    <context id="shiroTables" targetRuntime="MyBatis3" defaultModelType="flat">
        <commentGenerator>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>
        <jdbcConnection driverClass="${oracle.driver}"
	        connectionURL="${oracle.url}"
	        userId="${oracle.username}"
	        password="${oracle.password}">
        </jdbcConnection>
        <javaModelGenerator targetPackage="qooco.crm.model"
                            targetProject="src/main/java">
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
        <sqlMapGenerator targetPackage="sqlMapperXml"
                         targetProject="src/main/resources">
        </sqlMapGenerator>
        <javaClientGenerator type="XMLMAPPER"
                             targetPackage="qooco.crm.dao" targetProject="src/main/java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

		<!-- schema:指定dao文件所属分类文件夹| doaminObjectName:指定生成对象名 -->
        <table schema="" tableName="testKelvin" domainObjectName="TestKelvin"
               enableCountByExample="false"
               enableDeleteByExample="false"
               enableUpdateByExample="false"
               selectByExampleQueryId="false"
               enableSelectByExample="false">
            <generatedKey column="id_" sqlStatement="assigned" identity="true"/>
        </table>
    </context>
</generatorConfiguration>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics