Setting up Hibernate 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.
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. I did not find complete jars at one place. 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 see step by step configuration of Hibernate 3.0. In this articles I have explain all the required jars for Hibernate. I have also provided Sourceforge website link to download Hibernate 3.0 required jars. I have also explained 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 these database dependent jars along with above 9 jars in user library. Below you can get the specific jars for Mysql and Derby database.
The following are required for the MySql Database :
The following are required for the Derby setup :
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 – 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.
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 user library to a 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.
In this way you can add user libraries to your java project.
This is a basic article which explains Hibernate 3.0 required jars and setup in Eclipse. Please let me know your feedback by giving your comments.