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

被折叠的 条评论
为什么被折叠?



