Spring 3, JSF 2 and Hibernate 3 integration example

I will show how to integrate Spring 3, JSF 2 and Hibernate 3 in the following example. You may also read JSF 2, Spring 4, Hibernate 4 and Maven Integration

Download the required jars for Spring from https://spring.io, JSF from https://javaserverfaces.java.net/download.html and Hibernate from http://hibernate.org/orm/downloads/

Create web application using NetBeans or Eclipse or any Java based IDE.

Create Table in MySQL

Create Hibernate configurations and Model class

Configuration file : hibernate.cfg.xml in classpath


Hibernate mapping file : Cds.hbm.xml in com.jsfspring.spring.domain package


Model Class : Cds.java




Spring DAO layer


Spring bean for CD – cd.xml in com.jsfspring.spring.resources package


descriptor file – web.xml in WEB-INF


Java Server Faces Configuration file – faces-config.xml in WEB-INF


Spring configuration file – applicationContext.xml in WEB-INF

Create JSF ManagedBean

Thanks for your reading. Please leave a comment.

2 Replies to “Spring 3, JSF 2 and Hibernate 3 integration example”

  1. Hello Soumitra,
    i need your help, i don’t understand the role of Spring bean for CD in your tutorial and i need the javaBean with the index.xhtml, i work with netbeans 8.0.1
    Thank you very much

    1. I have just created it to separate beans from other spring config. you can put the beans in applicationContext.xml file also instead of creating separate c0onfig.

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.