天天看點

Myeclipse中Mybatis Generator插件的簡單使用二、插件的簡單使用

二、插件的簡單使用

工程目錄下建立generator的配置檔案

Myeclipse中Mybatis Generator插件的簡單使用二、插件的簡單使用

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="F:/SVN/lib/MySQL/mysql-connector-java-5.1.21.jar"/>  
    <context id="DB2Tables"  targetRuntime="MyBatis3">  
        <commentGenerator>  
            <property name="suppressDate" value="true"/>  
            <!-- 是否去除自動生成的注釋 true:是 : false:否 -->  
            <property name="suppressAllComments" value="true"/>  
        </commentGenerator>  
        <!--資料庫連結URL,使用者名、密碼 -->  
        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost/training" userId="root" password="root">  
        </jdbcConnection>  
        <javaTypeResolver>  
            <property name="forceBigDecimals" value="false"/>  
        </javaTypeResolver>  
        <!-- 生成模型的包名和位置-->  
        <javaModelGenerator targetPackage="com.glodon.bean" targetProject="SpringMVC_Mybatis_Demo">  
            <property name="enableSubPackages" value="true"/>  
            <property name="trimStrings" value="true"/>  
        </javaModelGenerator>  
        <!-- 生成映射檔案的包名和位置-->  
        <sqlMapGenerator targetPackage="com.glodon.mapper" targetProject="SpringMVC_Mybatis_Demo">  
            <property name="enableSubPackages" value="true"/>  
        </sqlMapGenerator>  
        <!-- 生成DAO的包名和位置-->  
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.glodon.dao" targetProject="SpringMVC_Mybatis_Demo">  
            <property name="enableSubPackages" value="true"/>  
        </javaClientGenerator>  
        <!-- 要生成哪些表-->  
        <table tableName="totalass" domainObjectName="AboutDto" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>  
        </context>  
</generatorConfiguration>  
           

在配置檔案上右鍵單擊

Myeclipse中Mybatis Generator插件的簡單使用二、插件的簡單使用

ps:Mybatis Generator插件的手動安裝

繼續閱讀