How to setup Hibernate 3.0 development environment ?
This tutorial explains you the Hibernate 3.0 required jars. It is a step by step guide to setup Hibernate environment in Eclipse and Netbeans IDE.
After doing complete set up we can do hibernate examples easily.
Moreover, you can read
When I started learning Hibernate it took me many hours to do complete Hibernate setup. I did not find a complete resource for Hibernate3.0 setup on a single website.
Basically, I did not find complete jars at one place. In fact I browsed lot of websites to find the complete solution.
Some were mentioning them but not providing resources from where I can download Hibernate jars. Some websites provided Jars but missed the other ones like configuration files, mapping files.
I remember I started at 10 AM (Morning) in the morning and I ended up with my first Hibernate Example around 1 PM (Night). Some basic knowledge will also play an important role. Moreover reading comment threads in tutorials helped me a lot.
So let us learn step by step configuration of Hibernate 3.0. I have explained all the required jars for Hibernate. I have also provided Sourceforge website link to download Hibernate 3.0 required jars.
Further, I have also explained how to setup Hibernate 3.0 in Eclipse.
List of Hibernate 3.0 required jars
Below mentioned 9 jars are required to work with Hibernate 3.0
Please download the above Hibernate 3.0 required jars from sourceforge website. I would suggest to download the .zip file from sourceforge website.
Apart from the above mentioned 9 jars, we need some Database dependent jars.
Database dependent jars to work with Hibernate
Apart from the above mentioned 9 jars, we need some database dependent jars. Developers use different databases.
I use MySql. You may use Oracle, derby or any other database.
So while doing Hibernate 3.0 setup we need to include our database dependent jars along with above 9 jars in project library. Below is the list of specific jars for Mysql and Derby database.
The following are required for the MySql Database :
The following are required for the Derby setup :
Basic tools required to Hibernate development
Apart from this we need some basic requirements
1. We must need JDK 1.6 or the latest version of JDK installed on our system. Please always use the latest JDK.
2. IDE – We can use the latest Eclipse, Netbeans. Moreover, By using IDE tool you can do examples more quickly. In this tutorial I will explain step by step guide to set up Hibernate required jars in Eclipse.
The same way we can follow in NetBeans also.
3. Database – We can use Database like MySql, Oracle or Apache Derby)
Setting Up Hibernate jars in Eclipse
So in the last we will have hibernate 3.0 required jars (List of Must have Hibernate 3.0 Jars + Database Dependent Jars) ready with us.
So now we will set up hibernate environment in Eclipse. It is nothing but adding the required jars in Eclipse library.
1. Please list out your jars and keep them in a folder like D:/lib/hibernate3.0
2. Open Eclipse and create one java project with name “Hibernate3SetUp”.
3. In Eclipse, go to Windows – Preferences – Java – Build Path – User Libraries
4. Click on New Button on the top right side of the Eclipse.
5. Now it will ask you to provide “User library name”. You can give it “hibernate3”. Say Ok.
6. After that please select “hibernate3” in user libraries and then click on “Add External Jars”.
You can add all the hibernate jars with you in this step.
How to add Hibernate 3.0 required jars library to Java Project ?
We have done with Hibernate 3.0 setup. We have added the required jars in Eclipse library. Whenever we will create a new project we have to add this “hibernate3” (user library) to our java project.
We can add this “hibernate3” user library when we are creating a java project newly. We can also add this user library “hibernate3” to existing java projects.
For adding this user library to your standalone java project please follow the following steps.
1. Create one java project. Give any name for java project. I am giving “HibernateHelloWorld”.
2. Click on next.
3. Go to Libraries tab and add the library “hibernate3”.
4. Then click on Finish.
So, in this way you can add user libraries to your java project.
Finally you learnt Hibernate 3.0 required jars. Also you learnt how to setup Hibernate in Eclipse and NetBeans IDE. Please let me know your feedback by giving your comments.
Once you have done with Hibernate setup please read how to create Hibernate session factory.