VOOZH about

URL: https://www.geeksforgeeks.org/java/hibernate-create-hibernate-configuration-file-with-the-help-of-plugin/

⇱ Hibernate - Create Hibernate Configuration File with the Help of Plugin - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Hibernate - Create Hibernate Configuration File with the Help of Plugin

Last Updated : 24 Mar, 2026

Hibernate configuration file can be easily created using IDE plugins, which simplify setup by generating the required XML structure automatically. This file (hibernate.cfg.xml) contains database connection details and Hibernate properties needed to run the application.

  • Plugins help auto-generate configuration, reducing manual errors
  • Stores database connection, dialect, and mapping settings
  • Makes Hibernate setup faster and beginner-friendly

Steps to Create Hibernate Configuration File Using Plugin

The following steps will guide you in creating and configuring a Hibernate XML configuration file in STS(Spring Tool Suite) using the Hibernate Tools plugin.

Step 1: Open Eclipse/STS IDE

  • Go to Help -> Eclipse Marketplace.
  • This is where you can search and install additional tools and plugins.
πŸ‘ Image

Step 2: Install JBoss Tools

  • In the search box, type JBoss Tools and select JBoss Tools 4.21.0.Final.
  • Click Install.
πŸ‘ Image

Step 3: Select Hibernate Tools Only

There is no need to install everything. Just deselect all and choose only the Hibernate Tools option. And click on Confirm button.

πŸ‘ Image

Step 4: Review the Terms and install

After that choose the accept terms button and click on the Finish button. 

πŸ‘ Image

Now the plugin has been installed successfully. with the help of this plugin, we are going to create Hibernate Configuration File. 

Step 5: Create a Maven Project

  • Go to File -> New -> Maven Project (or choose an existing project).
  • Choose the project location and click Next.

Step 6: Generate Hibernate Configuration File

  • In the resources folder, right-click -> New -> Other.
  • In the Wizard box, search for Hibernate Configuration File (cfg.xml).
  • Select it and click Next.
πŸ‘ Image

Step 7: Open New File Wizard

  • After clicking Next, a new wizard dialog opens for creating the Hibernate configuration file.
  • Here, you can see a preview of the file, and it’s ready to accept your configuration details.
πŸ‘ Image

Step 8: Configure File Location and Name

  • Choose the folder location (usually src/main/resources).
  • Optionally, rename the configuration file (default is hibernate.cfg.xml).
  • Click Next.
πŸ‘ Image

Step 9: Provide Database Details

  • Select your Database Dialect (e.g., MySQLDialect).
  • Choose your Driver Class (e.g., com.mysql.cj.jdbc.Driver).
  • Provide your Database URL, Username, and Password.
  • Click Finish.
πŸ‘ Image

Step 10: Verify the Configuration

You can see the configuration file has been generated and the corresponding property values have been set. 

πŸ‘ Image
Comment
Article Tags:
Article Tags: