Eclipse 中Hibernate tools 的安装和使用

eclipse 远程安装hibernate插件 自动生成model、map、dao 类。

 

 一:安装hibernate插件 步骤如下

eclipse->Help>Install New Software>Find and Install->add->
 (name:hibernate,URL:http://download.jboss.org/jbosstools/updates/stable/galileo/ ) eclipse3.6版本

3.7版本  改成 http://download.jboss.org/jbosstools/updates/stable/helios/
 ->OK-> 选择hibernate 点击next直到结束

Eclipse 中Hibernate tools 的安装和使用

 

 

插件安装完了  。

二.hibernate-configuration

切换到hibernate 视图。如下图

Eclipse 中Hibernate tools 的安装和使用

在左侧右键新建一个 add configuration 弹出 

Eclipse 中Hibernate tools 的安装和使用

选择工程   然后在Configurations file new一个新连接 如下图

 

Eclipse 中Hibernate tools 的安装和使用

finsh结束关闭窗口后   在第三个选项卡 ClassPath导入你要连接数据库的jdbc包

Eclipse 中Hibernate tools 的安装和使用

 

如果你不能看到上图所示的 Hibernate Configurations 窗口,说明你没有打开这个 View ,选择 Windows Show View Other ,然后选择 Hibernate Configurations 即可打开这个窗口。

三 . 接下来 产生数据库表映射 Java 对象


点击run  找到 Hibernate Code Generation Configurations  选择 反向代码输出目录

Eclipse 中Hibernate tools 的安装和使用


单击 Setup Create New 打开 Reverse engineer 配置向导 选择要生成的数据表

Eclipse 中Hibernate tools 的安装和使用

 

最后单击 Run 运行,产生代码。

产生的代码和配置文件,如图示; Hibernate Tools 到这里已经帮你完成的大量编码工作。

Eclipse 中Hibernate tools 的安装和使用