MyBatis Generator

  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="D:\Developer\ojdbc6.jar" />
	
  <context id="context1"  >

  	<!--给Example类添加方法来支持不区分大小写的LIKE搜索。这表明通过插件给Example类添加功能,而不是扩展这个类-->
  	<plugin type ="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin"/>
	
	<!--给由MBG生成的Java模型对象增加了equals和hashCode方法。-->
	<plugin type ="org.mybatis.generator.plugins.EqualsHashCodePlugin"></plugin>
	
	<!--通过重命名由MBG生成的Example类的方法演示initialized方法的用法。-->
  	<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin">  
	     <property name="searchString" value="Example$" />  
	     <property name="replaceString" value="Criteria" />  
	</plugin> 
	
	<!--添加一个新版本selectByExample方法接受RowBounds参数-->
	<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"></plugin>
	
	<!--不生成注释-->
  	<commentGenerator>  
         <property name="suppressAllComments" value="false" />  
 	</commentGenerator>  
  	
  	<!--数据库驱动-->
    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" 
    	connectionURL="jdbc:oracle:thin:@10.61.61.241:1521:inout" 
    	userId="testuser" 
    	password="testuser1" />
    	
    <!--model配置-->	
    <javaModelGenerator targetPackage="com.psts.wmf.model" targetProject="wmf" >
    	 <property  name="enableSubPackages"  value="false" /> 
    	 <property  name="trimStrings"  value="true" />
    </javaModelGenerator>
    
    <!--xml sql文件-->					
    <sqlMapGenerator targetPackage="com.psts.wmf.query" targetProject="wmf"  />
    
    <!--dao配置-->				 
    <javaClientGenerator targetPackage="com.psts.wmf.dao"  targetProject="wmf" type="XMLMAPPER" />
	
	<!--指定table-->				 
    <table schema="testuser" tableName="WMS_WAFER_MAP" domainObjectName	 ="WmsWaferMap" >
       <!--不生产Example类-->
       <!-- enableCountByExample="false"  enableUpdateByExample="false"  enableDeleteByExample="false"  enableSelectByExample="false"  selectByExampleQueryId="false" >-->
       <!-- <property name="useActualColumnNames"  value="true"/>-->
       <!--指定虚拟主键-->
       <!--<property  name="virtualKeyColumns"  value="ID1, ID2" />-->
    </table>

  </context>
</generatorConfiguration>

 其中的plugin是根据需求选配

 

附件是mybatis generator eclipse插件解压后覆盖eclipse  即可

资源地址

Mybatis 中文使用文档http://www.mybatis.org/mybatis-3/zh/index.html

Mybatis Generator中文文档http://generator.sturgeon.mopaas.com/index.html

Mybatis Eclipse 插件更新地址http://dl.bintray.com/harawata/eclipse

Mybatis 项目地址 http://blog.mybatis.org/

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值