使用环境说明:

OS:windows 7 64位

myeclipse: 2017 CI

1.安装

打开myeclipse--help---Install from catalog--选择eclipse应用市场---Find中填入 Mybatis (注意:区分大小写) 点go 搜索出

Mybatis Generator  选择安装.  关闭myeclipse 重新打开.

2.使用

在你的项目中创建一个 generatorConfig.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. <context id="context1">
  5. <!-- 数据库信息 -->
  6. <jdbcConnection connectionURL="jdbc:mysql://127.0.1.1/kanna"
  7. driverClass="com.mysql.jdbc.Driver"
  8. password="abc123456" userId="root" />
  9.  
  10. <javaModelGenerator targetPackage="org.mykanna.school.entity" targetProject="kanna/src/main/java" />
  11.  
  12. <sqlMapGenerator targetPackage="org.mykanna.mapper" targetProject="kanna/src/main/resources" />
  13.  
  14. <javaClientGenerator targetPackage="org.mykanna.school.dao" targetProject="kanna/src/main/java" type="XMLMAPPER" />
  15.  
  16. <!--
  17. 生成表并且不生成example
  18. tableName:表名
  19. domainObjectName:对象名
  20. -->
  21. <table tableName="tb_user" domainObjectName="User"
  22. enableCountByExample="false" enableUpdateByExample="false"
  23. enableDeleteByExample="false" enableSelectByExample="false"
  24. selectByExampleQueryId="false">
  25. </table>
  26.  
  27. </context>
  28. </generatorConfiguration>

xml 右键---run as---run Mybatis Generator

自动生成代码:

Mybatis 代码自动生成[myeclipse版]的更多相关文章

  1. MyBatis代码自动生成(利用命令)

    这几天在学习springmvc,需要用到mybatis,所以研究了一下mybatis自动代码生成,当然也可以手动敲,但是那样效率非常的慢,并且出错率也是很高的,利用MyBatis生成器自动生成实体类. ...

  2. MyBatis代码自动生成

    MyBatis的代码自动生成的功能,由于MyBatis属于一种半自动的ORM框架,所以主要的工作就是配置Mapping映射文件,但是由于手写映射文件很容易出错,所以可利用MyBatis生成器自动生成实 ...

  3. Spring Boot (七)MyBatis代码自动生成和辅助插件

    一.简介 1.1 MyBatis Generator介绍 MyBatis Generator 是MyBatis 官方出品的一款,用来自动生成MyBatis的 mapper.dao.entity 的框架 ...

  4. Mybatis 代码自动生成(generatorConfig.xml配置)

    博客推荐: Mybatis最入门---代码自动生成(generatorConfig.xml配置) MyBatis Generator generatorConfig.xml配置详解 pom.xml&l ...

  5. eclipse生成mybatis的逆向工程-mybatis代码自动生成

    首先,工作中一直在使用命令方式的mybatis的代码自动生成,今天把自己的笔记本直接搞一个在eclipse中生成的逆向代码生成工程,方便自己在家学习使用,在搞这个工程的过程中由于自己搞了一套环境,所i ...

  6. Mybatis代码自动生成(含测试)

    一.建立数据库 create database shixun; use shixun; create table user( id int primary key auto_increment , u ...

  7. mybatis-generator-gui--一个mybatis代码自动生成界面工具

    mybatis-generator-gui是什么 介绍mybatis-generator-gui之前,有必要介绍一下什么是mybatis generator(熟悉的同学可以跳过这一节).我们都知道,通 ...

  8. MyBatis代码自动生成(利用eclipse插件)

    上一篇文章已经介绍了利用命令的方式自动生成mybatis代码,但是每次都去运行cmd命令感觉还是有点麻烦,所以找了些资料发现eclipse里面也可以安装插件自动生成代码,下面简单介绍一下,也是给自己以 ...

  9. Mybatis -代码自动生成(generatorConfig.xml)

    参考:http://blog.csdn.net/jinshiyill/article/details/51546676 官方网址: http://www.mybatis.org/generator/c ...

随机推荐

  1. SpringBoot application.properties (application.yml)优先级从高到低

    SpringBoot application.properties(application.yml) 优先级从高到低 SpringBoot配置文件优先级从高到低 =================== ...

  2. 【代码审计】iCMS_v7.0.7 apps.admincp.php页面存在SQL注入漏洞分析

      0x00 环境准备 iCMS官网:https://www.icmsdev.com 网站源码版本:iCMS-v7.0.7 程序源码下载:https://www.icmsdev.com/downloa ...

  3. Explaining Delegates in C# - Part 6 (Asynchronous Callback - Way 3)

    By now, I have shown the following usages of delegates... Callback and Multicast delegatesEventsOne ...

  4. AngularJs HTML DOM、AngularJS 事件以及模块的学习(5)

    今天的基础就到了操作DOM,事件和模块的学习,其实我个人感觉学习起来AngularJS并没有想象中的那么的艰难,可能是因为这个太基础化吧,但是我们从初学开始就应该更加的自信一些,后来我可能会写一个小的 ...

  5. 在vs2012中使用installShield2015打包程序

    环境:vs2012,installShield2015 vs2012下写了一个小工具,winform的程序,在内部使用,网上搜索说是打包的话需要installShield,折腾之. installSh ...

  6. make: Warning: File `Makefile' has modification time 17 s in the future

    linux下,make makefile文件的时候报警告: make: Warning: File `Makefile' has modification time 17 s in the futur ...

  7. codeforces水题100道 第四题 Codeforces Round #105 (Div. 2) A. Insomnia cure (math)

    题目链接:http://www.codeforces.com/problemset/problem/148/A题意:求1到d中有多少个数能被k,l,m,n中的至少一个数整出.C++代码: #inclu ...

  8. Android学习之Handler消息

    Android系统规定,一些耗时的操作不能放在UI线程中去执行,这样会报一个ANR错误.所以为了避免该问题,我们需要开启一个新的线程去执行一些耗时操作:开启新的线程,将耗时的操作在新线程里面去执行, ...

  9. 《转载》WIN10 64位系统 32位Python2.7 PIL安装

    http://blog.csdn.net/kanamisama0/article/details/53960281 首先安装这个真的出了好多问题,之前装过一次PIL也失败了,就一直没管,今天刚好找了机 ...

  10. IOS设计模式第九篇之备忘录模式

    版权声明:原创作品,谢绝转载!否则将追究法律责任. 备忘录模式捕获和具体化对象的内部状态.换句话说,它可以节省你的东西后来,这种外部状态可以恢复在不违反封装; 也就是说,私人数据是私有的. 怎么用备忘 ...