Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Hibernate Spring Integration

In this section, you will learn how to Integration Hibernate with Spring.


How to write hello world example program in Hibernate? How to create one to one relationship in Hibernate 4 with Annotation? How to calculate minimum in Hibernate using the min() Function Hibernate 4.3.4 Released: Hibernate 4.3.4.Final Maven dependency Hibernate 4.3 Hello World: Example How to create SessionFactory in Hibernate 4.3.1? Hibernate 4 Hello World: Example of Hello World program Hibernate 4 create Session Factory: Example of creating Session Factory in Hibernate 4 Hibernate 4.3 and JPA 2.1 Example What is Hibernate in Java? Hibernate Overview and Architecture What is JPA 2.1? Hibernate 4.3.0.Final Maven dependency Hibernate 4.3 ORM Features Hibernate 4.3 Tutorial Hibernate Criteria average example Hibernate Criteria load all objects from table Hibernate Criteria Hibernate beginner tutorial Hibernate Session.delete() Example Hibernate save or update method example Hibernate Load Example Hibernate save Example - Rose India Hibernate 4 tutorials Hibernate Example Step by Step in Eclipse Hibernate Configuration files Setup Hibernate Environment Hibernate Architecture Hibernate Overview Hibernate 4.2 Tutorial Hibernate 4 Annotations Tutorial Hibernate 4 AnnotationSessionFactoryBean hibernate versions hibernate jndi hibernate tomcat hibernate metamodel generator hibernate entity Seam Hibernate C3P0 Hibernate hibernate shard hibernate means temporal hibernate jsf hibernate spring j2ee hibernate spring hibernate encrypted password alias_to_entity_map hibernate temporal jsf spring hibernate hibernate by example hibernate repository hibernate sample code

Hibernate Spring Integration

In this section, you will learn how to Integration Hibernate with Spring.

Spring Framework is widely known framework. In the below example, we will integrate Hibernate with Spring MVC web framework.

The project hierarchy is given below :

The jar file used in the project is given below :


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" version="2.5">


In the dispatcher-servlet.xml file, we will do the hibernate configuration.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:xsi="" xmlns:context=""

<context:property-placeholder location="" />
<context:component-scan base-package="net.devmanuals" />

<tx:annotation-driven transaction-manager="hibernateTransactionManager" />

<bean id="jspViewResolver"
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/view/" />
<property name="suffix" value=".jsp" />

<bean id="dataSource"
<property name="driverClassName" value="${database.driver}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.user}" />
<property name="password" value="${database.password}" />

<bean id="sessionFactory"
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<property name="hibernateProperties">
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>

<bean id="hibernateTransactionManager"
<property name="sessionFactory" ref="sessionFactory" />


If you are not aware of Spring or need further help click here.


When you execute the project, you will get the following output in browser :

The first page will appear like this :

When you click on List of Articles hyperlink, you will get the following output :


If you click on Add Article hyperlink, you will get the following page :

For Complete code of this project click below.

Download Source Code


Share on Google+Share on Google+

Hibernate Spring Integration

Posted on: March 24, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Hibernate Spring Integration  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image