Hibernate Tools with Eclipse

本文介绍如何在 Eclipse 中安装 Hibernate Tools 并利用该工具生成 Hibernate 配置文件及源代码。首先通过 Eclipse 的帮助菜单安装 Hibernate Tools 插件,然后设置配置文件并指定数据库连接参数,最后通过 Hibernate 控制台从 JDBC 连接中逆向生成代码。
>>> install hibernate tools in eclipse


> select eclipse menu 'Help' - 'Install New Software...' to open a dialog and add the new site http://download.jboss.org/jbosstools/updates/stable/ to install/update hibernate tools as follows.

 

> eclipse will auto link to the site to show you the plug-ins you can install/update

 

> select hibernate tools to install

 

>>> generate hibernate configuration files with hibernate tools
 
> Pre-condition : database is ready and tables are created already.
> open perspective for hibernate tools in eclipse

 

> right click the work-place and select 'Add Configuration...' to open 'Edit Configuration' dialogue.

 

> click 'Setup...' button to add a new configuration file .cfg.htm

 

 

> specify the file name and path

 

> specify the database and connection parameters,etc.

 

> specify the database dialect

 

> then this tool will generate hibernate_web.cfg.xml in folder /enotebook/config

 

>>> generate source code with hibernate tools
 
> click 'Run As...' button in the toolbar and select 'Hibernate Code Generation Configurations...'

 

 

> right click the menu on the left column and select 'New' to create a hibernate console

 

>  take note the 'Reserve engineer from JDBC Connection' should be selected.

 

 

then click Run button and you will find some files generated in /enotebook/tmp folder

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值