Hibernate Tools for Eclipse的使用
Hibernate Tools的官方网站:http://hibernate.org/tools/
Step1、安装好Hibernate Tools,建立一个Dynamic web project,工程名为“test”。
Step2、以Mysql为示例,建立相应的测试数据库及表,如下所示:
- mysql> use test;
- Database changed
- mysql> show tables;
- +----------------+
- | Tables_in_test |
- +----------------+
- | customer |
- | login |
- +----------------+
- 2 rows in set (0.10 sec)
Step3、将MySql的Jdbc驱动库(mysql-connector-java-5.0.8-bin.jar)拷贝至lib目录。
Step4、利用Hibernate Tools生成Hibernate的cfg.xml。如下图:
直接默认转到下一步的配置界面,配置如下图:
点击完成(Finish)后,它将生成如下xml的配置文件(hibernate.cfg.xml):
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
- <hibernate-configuration>
- <session-factory>
- <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
- <property name="hibernate.connection.password">gjs@y1</property>
- <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
- <property name="hibernate.connection.username">root</property>
- <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
- </session-factory>
- </hibernate-configuration>
Step5、利用Hibernate Tools生成Hibernate的Console配置。如下图:
点击完成(Finish)后,它将生成配置文件,如下图:
Step6、利用Hibernat Tools生成Hibernate的reveng.xml配置。如下图:
直接默认转到下一步的配置界面,配置如下图:
点击完成(Finish)后,它将生成如下xml的配置文件(hibernate.reveng.xml):
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-reverse-engineering PUBLIC
- "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
- <hibernate-reverse-engineering>
- <table-filter match-catalog="test" match-name="customer" />
- <table-filter match-catalog="test" match-name="login" />
- </hibernate-reverse-engineering>
Step7、最后一步了,生成映射文件和Java代码。如下图:
点击运行(Run)后,它将生成如下映射文件和Java代码文件,如下图:
参考:http://www.cnblogs.com/abllyboy/archive/2010/12/23/1914577.html
Hibernate Tools for Eclipse的使用的更多相关文章
- Hibernate Tools for Eclipse安装
声明:本文转载自 http://developer.51cto.com/art/200906/128067.htm Hibernate Tools for Eclipse Plugins 的安装和使用 ...
- Hibernate入门第二课 Hibernate Tools for Eclipse Plugins安装
Hibernate入门第二课 Hibernate Tools for Eclipse Plugins安装 你们可以直接去,http://blog.csdn.net/wei_chong_chong/ar ...
- 01-Hibernate Tools for Eclipse Plugins安装
Hibernate Tools for Eclipse Plugins安装 在线安装有两种方法 方法一:"Help > Install New Software Updates&quo ...
- eclipse中怎么添加Hibernate tools
最近在学习Hibernate框架,但是用eclipse的时候发现自己安装的过程不是很顺利,因此记下来,供自己和别人参考. Hibernate Tools是由JBoss推出的一个Eclipse集成开发工 ...
- eclipse怎样在线安装hibernate tools插件并使用
不知不觉,小Alan已经将近3个月没有上班了,最近在复习一些知识,随时准备回到代码世界的战场,今天复习到了Hibernate,记录一下一点点小知识,那就是eclipse下hibernate Tools ...
- 【转】eclipse下使用hibernate tools实现hibernate逆向工程
一.基本环境 Eclipse 3.6 AppFuse Struts2 2.1.0 JBoss Hibernate Tools 3.4.0 二.JBoss Hibernate Tools 3.4.0安装 ...
- eclipse插件hibernate tools安装 爱好者
eclipse helios(3.6)版 1.启动eclipse 2.选择Help > Install New Software...> 3.添加如下地址:http://download. ...
- eclipse(Version: Neon Release (4.6.0))安装hibernate tools
这里需要说明的是,hibernate tools是jboss推出的. eclipse——>Eclipse Marketplace... 输入jboss-tools进行搜索 选择jboss too ...
- eclipse下使用hibernate tools实现hibernate逆向工程
一 安装hibernate tools插件 1 在线安装 通过Eclipse的Help->Install New Software 在线安装插件,插件连接为: eclipse helios(3 ...
随机推荐
- 微信小游戏canvas操作
这几天在做项目的时候,想在游戏画面之前,在Canvas上面画上一张背景图,代码如下 let ctx = canvas.getContext('2d') export default cl ...
- Ubuntu18.04 - 安装深度桌面(Deepin Linux Desktop)
深度Linux官网:https://www.deepin.org 深度桌面感觉确实不错,所以打算安装上来,以后体验一下,下面是安装的命令: 1, sudo add-apt-repository ppa ...
- 如何让一个input输入框居中
<div style="text-align:center;vertical-align:middel;"><input type="text" ...
- 《Python自动化运维之路》 业务服务监控(二)
文件内容差异对比方法 使用diffie模块实现文件内容差异对比.dmib作为 Python的标准库模块,无需安装,作用是对比文本之间的差异,且支持输出可读性比较强的HTML文档,与 Linux下的di ...
- Maximum repetition substring(POJ - 3693)(sa(后缀数组)+st表)
The repetition number of a string is defined as the maximum number \(R\) such that the string can be ...
- svn重新安装后报You need to upgrade the working copy first错误
问题来源 最近重新安装了操作系统,安装了一个最新版的svn,提交代码的时候报了一个错误:You need to upgrade the working copy first,!网上找了很多解决办法,都 ...
- linux下mysql的远程访问
安装了虚拟机centos,安装mysql后,在win7下无法用工具访问mysql.提示连接失败. 1.授权远程访问. GRANT ALL PRIVILEGES ON databasename.* TO ...
- 组件基础(插槽slot)—Vue学习笔记
刚开始我们淡淡提过<slot></slot>现在深入了解一下. slot可以进行父组件传值到子组件. 比如:我们将hiboy通过<slot>传递到组件中. < ...
- Upgrade Win10
Internal deployment of Windows 10 Enterprise is currently underway as a phased deployment. Watch you ...
- MapReducer
MapReducer 概述 是一个分布式的计算框架(编程模型),最初由由谷歌的工程师开发,基于GFS的分布式计算框架.后来Cutting根据<Google Mapreduce ...