首页 > Java开发 > Eclipse配置 MyBatis Generator

Eclipse配置 MyBatis Generator

1.插件安装

     官网 http://www.mybatis.org/generator/index.html

     插件地址: https://dl.bintray.com/mybatis/mybatis-generator

2新建generatorConfig.xml

     插件安装完成后  右键---新建--other--mybatis 。

    默认在项目目录下新建generatorConfig.xml

3配置generatorConfig.xml

Xml代码
  1.   <?xml version="1.0" encoding="UTF-8"?>  
  2. <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">  
  3. <generatorConfiguration>  
  4.   <classPathEntry location="/home/cooperay/.m2/repository/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar"/>  
  5.   <context id="context1">  
  6.     
  7.   <commentGenerator>  
  8. <property name="suppressAllComments" value="true"/>  
  9. </commentGenerator>  
  10.    
  11.     <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.99.253/mlmerp" userId="root" password="password"/>  
  12.     <javaModelGenerator targetPackage="com.cooperay.facade.manage.entity" targetProject="cop-service-base">  
  13. <property name="enableSubPackages" value="true"/>  
  14. <property name="trimStrings" value="true"/>  
  15. </javaModelGenerator>  
  16.     <sqlMapGenerator targetPackage="mybatis.mapper" targetProject="cop-service-base">  
  17. <property name="enableSubPackages" value="true"/>  
  18. </sqlMapGenerator>  
  19.     <javaClientGenerator type="XMLMAPPER" targetPackage="mlm.dao.base" targetProject="cop-service-base">  
  20. <property name="enableSubPackages" value="true"/>  
  21. </javaClientGenerator>  
  22.     <table tableName="billnumber" domainObjectName="BillNumber" enableCountByExample="false"   
  23.     enableUpdateByExample="false" enableDeleteByExample="false"   
  24.     enableSelectByExample="false" selectByExampleQueryId="false"/>  
  25.   </context>  
  26. </generatorConfiguration>  

本文固定链接: http://www.devba.com/index.php/archives/6547.html | 开发吧

报歉!评论已关闭.