Saturday, April 10, 2010

Hibernate Tools with Eclipse

>>> 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

No comments:

Post a Comment