You need to have the following tool installed on your
machine.
- Eclipse
- JBoss Hibernate Tools plugin for eclipse
- Oracle jdbc driver
- Required Hibernate Jars
Open the Hibernate Tools perspective in Eclipse.
Now create the oracle database connection for
hibernate configuration by clicking New Button.
Upon Pressing New Button. A popup will appear
with title connection profile. Select Oracle from the available list and give
the connection profile a name and press Next Button.
Select the JAR List from the available tabs and provide the path of driver’s jar file.

Set the driver properties by clicking on Properties tab.
Once you complete the driver’s settings. Then
the driver’s information updated in the “Specify a Driver and Connection
Details” popup as follows. Select the Save Password checkbox to keep remember
the password and select “User” from Catalog.
Press the “Test Connection” button to test the
DB connection. If the connection details are correct then you have the success
message in the popup as follows.

Next Create the cfg.xml configuration file by
click “Setup Button” in front of Configuration file option as follows. A new
popup will appear asking for Create new configuration file or use existing
configuration file.
Upon clicking “Create New…” button, you will
asked to provide the path and name of the configuration file as follows. Then
press Next button.

Upon pressing Next button. You need to provide
configuration details for hibernate as follows and press Finish.
Upon pressing “Finish”. The configuration file
name loaded in the “Specify a Driver and Connection Details” popup as follows.
Now press Apply and OK button to complete the configuration.
Now right click the configuration name in the
left panel and select “Edit Configuration” to update the database dialect.
Now select the database Dialect from the
available list under the Options Tab. Then press Apply and OK.
Now expand hibernate configuration node from the
left panel and then expand Database node. Database schemas populated if the
configuration is correct.
From the option bar on top select the Hibernate
Code Generation and select the “Hibernate Code Generation Configuration” option
from the menu.
To generate the code Select configuration that
we created before, provide the path of output directory and select the check
box against “Reverse engineer from JDBC Connection”, provide the optional
package name then create setup button to generatge “reveng.xml” file.