Mybatis自动生成插件使用

Mybatis-generator的使用

下载eclipse插件Mybatis-generator,解压,放到eclipse安装目录,覆盖features,plugins,重启eclipse。

编写自动生成需要的配置文件:

<?xmlversion="1.0"encoding="UTF-8"?> 

<!DOCTYPEgeneratorConfiguration PUBLIC"-//mybatis.org//DTDMyBatis Generator Configuration 1.0//EN""http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

    <classPathEntrylocation="D:/workspace/MybatisTest/WebContent/WEB-INF/lib/db2java.jar"/>

    <classPathEntrylocation="D:/workspace/MybatisTest/WebContent/WEB-INF/lib/db2jcc.jar"/>

    <classPathEntrylocation="D:/workspace/MybatisTest/WebContent/WEB-INF/lib/db2jcc_license_cu.jar"/>

    <contextid="context1">

        <jdbcConnectiondriverClass="com.ibm.db2.jcc.DB2Driver"

            connectionURL="jdbc:db2://192.168.8.10:60020/web"userId="tst_db"

            password="tst_db"/>

        <javaModelGeneratortargetPackage="com.test.persistence.mybatis.model"

            targetProject="MybatisTest"/>

        <sqlMapGeneratortargetPackage="com.test.persistence.mybatis.model"

            targetProject="MybatisTest"></sqlMapGenerator>

        <javaClientGeneratortargetPackage="com.test.persistence.mybatis.model"

            targetProject="MybatisTest"type="XMLMAPPER"/>

        <tableschema=""tableName="T_O_INF"domainObjectName="TOInf"></table>

        <tabletableName="t_o_log"domainObjectName="TOLog" 

        enableCountByExample="false"enableUpdateByExample="false"enableDeleteByExample="false"enableSelectByExample="false"selectByExampleQueryId="false"></table>

    </context>

</generatorConfiguration>

 

 

选中文件,右键,点击“Generate Mybatis….”ok。所有文件已经自动生成。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值