Developing Hibernate 4 Hello World Example
In this section you will learn how to develop your first Hibernate 3.4 Hello World example.
Now this version of Hibernate 4.3.x ORM is supporting the latest version of JPA which is JPA 2.1. You can learn about JPA 2.1 at JPA 2.1 tutorial section.
Prerequisites:
- JDK 7 or above must be installed on your computer
- Eclipse IDE is required
- MySQL database server should be running and accessible
- You should have good knowledge of Java programming and JDBC programming
We have used the Eclipse IDE for coding and testing of the application.
Here are the steps to develop the Hibernate 4.3 Hello World Example program steps:
Step 1: Download the Hibernate 4.3.x : First of all you have to download the Hibernate 4.3.x latest release.
Step 2: Create database and table - Next you have to create database and tables
Step 3: Add libraries: You should create Eclipse project and add the Hibernate libraries files. You will also have to add the MySQL JDK driver jar file.
Step 4: Create model class - Now you should create the model class
Step 5: Create hibernate.cfg file - Create the configuration file of Hibernate framework
Step 6: Create the utility class for getting SessionFactory - Learn how to get the SessionFactory in Hibernate 4.
Step 7: Write the code for testing the Hello World Hibernate example - finally test the application.
Check the complete tutorial with source code.
Read Complete Hibernate 4.3.x tutorial at Hibernate 4.3.x home page.