天天看點

MyEclipse10中mybatis generator插件的安裝使用

1、下載下傳mybatis generator插件包

2、解壓插件包擷取features 和 plugins 兩個檔案夾,将兩個檔案夾放入新檔案夾 mybatis_generator檔案夾中

3、将mybatis_generator放到MyEclipse 10\dropins這個目錄下,重新開機MyEclipse,ok!

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

<!-- 配置mysql 驅動jar包路徑.用了絕對路徑 -->

<classPathEntry location="E:\Workspaces\MySpring3\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.22-bin.jar" />

<context id="yihaomen_mysql_tables" targetRuntime="MyBatis3">

<!-- 為了防止生成的代碼中有很多注釋,比較難看,加入下面的配置控制 -->

<commentGenerator>

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

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

</commentGenerator>

<!-- 注釋控制完畢 -->

<!-- 資料庫連接配接 -->

<jdbcConnection driverClass="com.mysql.jdbc.Driver"

connectionURL="jdbc:mysql://localhost:3306/ycnet?characterEncoding=utf8"

userId="root"

password="123">

</jdbcConnection>

<javaTypeResolver >

<property name="forceBigDecimals" value="false" />

</javaTypeResolver>

<!-- 資料表對應的model 層 targetProject内容問 項目名\src  -->

<javaModelGenerator targetPackage="com.yihaomen.model" targetProject="MySpring3\src">

<property name="enableSubPackages" value="true" />

<property name="trimStrings" value="true" />

</javaModelGenerator>

<!-- sql mapper 隐射配置檔案 -->

<sqlMapGenerator targetPackage="com.yihaomen.mapper" targetProject="MySpring3\src">

<property name="enableSubPackages" value="true" />

</sqlMapGenerator>

<!-- 在ibatis2 中是dao層,但在mybatis3中,其實就是mapper接口 -->

<javaClientGenerator type="XMLMAPPER" targetPackage="com.yihaomen.inter" targetProject="MySpring3\src">

<property name="enableSubPackages" value="true" />

</javaClientGenerator>

<!-- 要對那些資料表進行生成操作,必須要有一個. -->

<table schema="account" tableName="core_account" domainObjectName="account"

enableCountByExample="false" enableUpdateByExample="false"

enableDeleteByExample="false" enableSelectByExample="false"

selectByExampleQueryId="false">

</table>

</context>

</generatorConfiguration>