Download Hibernate Tool and extract content to root folder of Eclipse (should merge plugins and features folders).WH.performance.mark('step1_rendered');

Download Hibernate Tool and extract content to root folder of Eclipse (should merge plugins and features folders).

Start eclipse.

Start eclipse.

Click on [File -> New -> Other -> Hibernate -> Hibernate Configuration File] and create a cfg file. The following properties should be specified : jdbc url , username, password, DB schema, driver class and dialect.

Click on [File -> New -> Other -> Hibernate -> Hibernate Configuration File] and create a cfg file.

Click on [File -> New -> Other -> Hibernate -> Hibernate Console Configuration ] and create a new console configuration. Add the jar file that contains your DB driver in the classpath section at the bottom.

Click on [File -> New -> Other -> Hibernate -> Hibernate Console Configuration ] and create a new console configuration.

Enter the name of the console configuration. Click Browse button against the Configuration file and select the cfg.xml file created in step 3.

Enter the name of the console configuration.

Click on [File -> New -> Other -> Hibernate -> Hibernate Reverse Engineering File(reveng.xml) ] and select the location of the file.

Click on [File -> New -> Other -> Hibernate -> Hibernate Reverse Engineering File(reveng.xml) ] and select the location of the file.

Select the cfg.xml file created in step 3 as the Console Configuration. Click on include button and specify the schema and table name(s) to reverse engineer. Multiple table names can be specified using sql wild char (eg: TBL_%). Click Finish.

Select the cfg.xml file created in step 3 as the Console Configuration.

Switch to the Hibernate perspective and Click on the Hibernate icon in the tool bar and select the [Hibernate Code Generation ..] option.

Switch to the Hibernate perspective and Click on the Hibernate icon in the tool bar and select the [Hibernate Code Generation .

Right click on the [Hibernate Code Generation]tree node and select New.

Right click on the [Hibernate Code Generation]tree node and select New.

Give the name of the configuration and select the console configuration created in step 5 and reveng.xml created in step6-7. Also select the Output Directory and a relevant package.

Give the name of the configuration and select the console configuration created in step 5 and reveng.xml created in step6-7.

Go to the Exporters tab and check Generate domain code(.java) and Generate mappings (hbm.xml). Click run.

Go to the Exporters tab and check Generate domain code(.java) and Generate mappings (hbm.xml).

The hibernate mapping xml files and Java classes will be created in the output directory specified in step 11.

The hibernate mapping xml files and Java classes will be created in the output directory specified in step 11.

Tags:
Tomasz David
Tomasz David

Leave a Comment