MyBatis Generator自动创建代码
来源:互联网 发布:thrift python 编辑:程序博客网 时间:2024/05/22 17:48
原始文 出处http://blog.csdn.net/zhshulin/article/details/23912615
这两天需要用到MyBatis的代码自动生成的功能,由于MyBatis属于一种半自动的ORM框架,所以主要的工作就是配置Mapping映射文件,但是由于手写映射文件很容易出错,所以可利用MyBatis生成器自动生成实体类、DAO接口和Mapping映射文件。这样可以省去很多的功夫,将生成的代码copy到项目工程中即可。
使用自动生成有很多方式,可以在eclipse中安装插件,但是以下将要介绍的这种方式我认为很轻松,最简单,不需要装插件,只需要下几个jar包即可,把它们放在一个目录下面。
生成代码需要的文件和jar包:
(上图文件下载地址:http://download.csdn.net/detail/u012909091/7206091)
其中有mybatis框架的jar包,数据库驱动程序jar包以及MyBatis生成器jar包。其中的generatorConfig.xml是需要我们来配置的文件,配置如下:
当以上这些完成之后,只需要打开控制台,进入lib目录下,执行脚本:
java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite
即可。
这样在生成之后,就可以在src目录下找到相应的文件夹,每个表格都会对应三个文件(实体类、接口、配置文件)。
0 0
- MyBatis Generator自动创建代码
- MyBatis Generator 自动创建代码
- MyBatis Generator自动创建代码
- MyBatis Generator自动创建代码
- MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用mybatis generator自动创建代码
- [SSM]使用MyBatis Generator自动创建代码
- dxNavBar获得右键菜单位置的dxNavBarItem。
- wordpress 通过get_the_excerpt和the_excerpt函数获取文章摘要
- mac中打开隐藏的文件
- Spring MVC之@RequestParam @RequestBody @RequestHeader 等详解
- 常用软件下载 SwitchHosts
- MyBatis Generator自动创建代码
- 自然语言查询接口IDCQ(一)项目综述
- js页面跳转方法
- 总结ASP.NET MVC Web Application中将数据显示到View中的几种方式
- Spring MVC之@RequestMapping 详解
- Vue.js学习系列(三)---第一个vue.js程序
- 浅谈微信小程序对于房地产行业的影响
- Leader/Follower线程模型
- Java中Collection和Collections的区别