Creating a Hibernate Utility Helper

See Also

To use Hibernate you need to create a helper class that handles startup and that accesses Hibernate's SessionFactory to obtain a Session object so that you can load and store objects. The helper class calls configure() and loads the hibernate.cfg.xml configuration file. The helper class then builds the SessionFactory to obtain the Session object.

To create the HibernateUtil.java helper class:

  1. In the Projects window, right-click the Source Packages node and choose New > Other to open the New File wizard.
  2. Select Hibernate from the Categories list and HibernateUtil.java from the File Types list. Click Next.
  3. Type HibernateUtil for the class name. Click Finish.

When you click Finish, the file HibernateUtil.java opens in the Source Editor. You do not need to edit the file.

See Also
Creating the Hibernate Configuration File
Adding Hibernate Support to a Project
About Hibernate Support

Legal Notices