This tutorial is part of the Hibernate introduction series. This is to help setup and getting started with Hibernate. Needless to say, we need JDK. Our choice of IDE is Eclipse, build tool is Maven. You can do with Netbeans or any other editor. ANT or any other build tool is also fine.
Important part is the configuration of the needed Hibernate libraries. If you are new to Maven, go through detailed information for Maven download and setup and Maven in 10 minutes tutorial.
Ensure that you have some version of JDK configured as below in Eclipse preferences.
If you have setup Maven correctly, you should have preferences similar to the following
Maven is a build tool by Apache, it will help to manage the dependencies better. Now, I will create Standard Java Project, add required JARs, compile and package using Maven. All of these listed tasks are executed by Maven behind you.
Following below steps are the needed steps for creating full-fledged Java Project with all required Hibernate libraries.
For now, your Hibernate project is created but still you need to add required dependencies/libraries that Hibernate requires to work.
For getting started with Hibernate, the required libraries are:
The projects Maven pom.xml is as below,
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.javapapers</groupId> <artifactId>Hibernate-Sample</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Hibernate-Sample</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.6.Final</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.31</version> </dependency> </dependencies> </project>
With this a basic shell project is ready for Hibernate based development. In the next tutorial we will see how to configure the Hibernate properties, session and connect the database.
Comments are closed for "Hibernate Development Environment with Eclipse and Maven".
[…] an example Hibernate application and you need to setup the development environment. Follow the linked tutorial to setup the project and put the following Java class file and run […]
[…] Setup the Hibernate development environment by referring this previous tutorial. […]
Where is the src/main/resources folder
Very nice description!!
That’s One is Fantastic Description…
Thanks man