Configuring hibernate in eclipse

Tutorial Content:

After basic understanding of hibernate framework.We are ready to start working on hibernate In this post,we will configure hibernate in eclipse.For configuring hibernate,there are some prerequisites which you need to have on your system.

  1. Download hibernate framework.(I am using here latest hibernate version 4.1.9)
  2. Download any database.(I am using here sql server 2005)
  3. Download JDBC driver for database(I have downloaded jdbc driver for sql server 2005)
  4. Eclipse ide
  5. JDK 1.5 or above

Now,In eclipse IDE,click on File->new

Click on other and then select java project


Click on next and  Write project name.I have writtern here “Hibernate4HelloWorldProject”

Click on finish and now our project is created
Create new folder “jars” under src folder so for that right click on project->new->folder

Write folder name as “jars”

click on finish and empy jar folder will be created in src folder.
Now we will add the hibernate 4 libraries to the project. Extract the “hibernate-release-4.1.9.Final” file if you have not extracted. Now go to the “hibernate-release-4.1.9.Final->lib->required” directory and then copy all the jar files (Ctrl+C) and paste on the jars directory (of our project) in the Eclipse IDE.
Also download jdbc driver for your database and copy that jar to jars
Note- location of above jar files may vary from versions to versions. So if you are using other versions than 4.1.9 then you need to find jars in that version.

Now add all the jars to “Java Build Path”. Right click on the “Hibernate4HelloWorldProject” in project explorer and then select properties. Then select “Java Build Path” –> Libraries and then click on the “Add JARs” button. And add all the libraries to Java Build Path.

Click on OK.

Now you are done with configuring hibernate in eclipse.You can create your first hibernate project.
In next post we will write

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *