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/