git地址:https://github.com/mybatis/generator

下载后解压:

选择任意一个版本的jar放到eclipse的features目录下即可

选择任意一个版本的jar放到eclipse的plugins目录下即可

重启eclispe

需要mybatis-generator-core.jar

<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>

右键-new,会有MyBatis,在指定项目目录下生成generatorConfig.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>
<!-- oracle lib location -->
<classPathEntry location="E:\backup\repository\mysql\mysql-connector-java\5.1.40\mysql-connector-java-5.1.40.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.1.2:3306/palm_2_0_16" userId="root"
password="sqj888">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver> <!-- model package and location -->
<javaModelGenerator targetPackage="cn.zsmy.entity" targetProject="palmdoctor.code\src\main\java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- mapping package and location -->
<sqlMapGenerator targetPackage="cn.zsmy.mapper" targetProject="palmdoctor.code\src\main\java">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- dao package and location -->
<javaClientGenerator type="XMLMAPPER" targetPackage="cn.zsmy.mapper" targetProject="palmdoctor.code\src\main\java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator> <table tableName="tb_hello" domainObjectName="Hello"
enableCountByExample="false" enableUpdateByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false" /> </context>
</generatorConfiguration>

已存在generatorConfig.xml就不需要新建了,也可以直接copy的。

没报错就是成功了

去掉Mybatis Generator生成的一堆 example

原文:http://www.cnblogs.com/lyh421/p/5672569.html

mybatis generator自动生成的代码里老是有一堆example,需要改的时候,generatorConfig.xml文件的配置的方法如下:
 
<table schema="general" tableName="tb_table_name" domainObjectName="EntityName"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" >
<property name="useActualColumnNames" value="true"/>
</table>

我的修改:

 
 
运行之后,确实没有了。

eclipse中mybatis generator插件的安装与使用,实现自动生成代码的更多相关文章

  1. 2016.7.12 eclipse和IDEA中mybatis generator插件的安装与使用

    Eclipse中的安装 http://jingyan.baidu.com/article/9faa7231506ed8473c28cbee.html 1.下载插件 2.将插件generator的fea ...

  2. Eclipse 使用mybatis generator插件自动生成代码

    Eclipse 使用mybatis generator插件自动生成代码 标签: mybatis 2016-12-07 15:10 5247人阅读 评论(0) 收藏 举报 .embody{ paddin ...

  3. eclipse中的aptana插件的安装

    先下载 aptana插件包   我安装的eclipse版本是 indido版本号的. 三步骤: 1.将aptana解压到eclipse的目录下 2.打开eclipse目录下的dropins文件,新建一 ...

  4. IDEA结合mybatis插件自动生成代码

    pom文件 添加插件 <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>myb ...

  5. Eclipse MyBatis Generator插件安装

    目录 Eclipse MyBatis Generator插件安装 Eclipse MyBatis Generator插件安装 1.进入Eclipse Marketplace [Help] -> ...

  6. mybatis generator 插件安装及使用

    现在Mybatis特别火,但是在开发中却要经常写实体类和配置文件,会不会特别烦人,所以可以利用Mybatis的代码生成插件来生成这部分代码: 1,打开eclipse,点击Help>Softwar ...

  7. Windows下安装Python及Eclipse中配置PyDev插件

    最近开始接触Python,鉴于之前安装Java的教训,决定这次边安装Python,边写下历程,供日后反复使用. 在Python官网http://www.python.org/下载Python版本,鉴于 ...

  8. Myeclipse2014添加mybatis generator插件

    Myeclipse2014把mybatis generator插件直接放在dropins文件夹下,重启后不能成功安装mybatis插件. 既然离线安装不成功,可以选择在线安装 1.选择 Help-&g ...

  9. 通过eclipse mybatis generater代码生成插件自动生成代码

    Mybatis属于半自动ORM,在使用这个框架中,工作量最大的就是书写Mapping的映射文件,由于手动书写很容易出错,我们可以利用Mybatis-Generator来帮我们自动生成文件.通过在Ecl ...

随机推荐

  1. 【N-Queens】cpp

    题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two que ...

  2. 【Luogu P3371&P4779】【模板】单源最短路径(线段树优化Dijkstra)

    线段树优化$\rm dijkstra$ 线段树每个节点维护$[l,r]$中$dist$最小的点,删除则把该点$dist$赋值为$+\infty$,然后更新该点影响到的线段树上的其他节点即可. 可以得到 ...

  3. pycharm许可证过期

    1.选择enter license 2.选择license server 3.输入http://idea.imsxm.com 4.点击ok 好,解决了

  4. wordpress 区分多语言站点

    $blog_title = get_bloginfo( 'name' ); $table_name = ''; if ( $blog_title == 'Driver Easy' ) { $table ...

  5. 502 Bad Gateway 怎么解决?

    出现502的原因是:对用户访问请求的响应超时造成的 服务端解决办法: 1.提高 Web 服务器的响应速度,也即减少内部的调用关系,可以把需要的页面.素材或数据,缓存在内存中,可以是专门的缓存服务器 , ...

  6. centos 7 配置ip

    1.动态获取ip(前提是你的路由器已经开启了DHCP) 修改网卡配置文件 vi /etc/sysconfig/network-scripts/ifcfg-ens32    (最后一个为网卡名称) 动态 ...

  7. Oracle 查看锁定对象 解锁

    一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库.现在提供一种方法解决这种问题,那就是在ORACLE中杀不 ...

  8. linux服务器上设置多主机头,设置多web站点

    假设VPS的IP是58.130.17.168,有两个域名指向该IP,分别是domain1.com, domain2.com, 修改/etc/httpd/conf/httpd.conf,在文件的最后加入 ...

  9. linux系统——网络调试工具

    http://blog.csdn.net/chinalinuxzend/article/details/1799279 1.网络调试工具概说: 如 果我们把一台机器接入网络中,通过网络配置工具的配置这 ...

  10. Normalize.css用法

    1 Normalize.css用法 重置样式非常多,Normalize.css和reset是两个常用的重置 CSS 文件 http://necolas.github.io/normalize.css/ ...