jsf spring hibernate
In this section, you will learn integration of jsf spring hibernate.
In this section, you will learn how to configure Hibernate, Spring and MyFaces(JSF) to use MySQL Database to build real world User registration and login application.
This section contains a complete example which contains user registration and login application where new user can create an account with the system. Existing users can access the website by providing their user name and password.
JSF, Spring or Hibernate can be used for different purposes according to the utility and strength of each frameworks. Like,
- JSF can be used to implement presentation layer because it fits into the
MVC design pattern.
- Spring Framework can be used in the business logic tier to manage
business objects, resource management.
- Hibernate can be powerful inside the integration tier. Spring integrates
Hibernate very well.
Application architecture
Our Login and Registration application consists of 3 different layers (tiers)
- Presentation Layer
- Business Layer
- Data Access Layer
In this application the presentation layer, business layer and data access layer are physically located on the same JEE server. The different layers of the application are isolated from each other and connected through well defined interfaces.
Three tier architecture of the application:
Presentation Layer
JSF is used to build the presentation layer of the application. JFS allows us to create rich GUI for web application. It resolves the technical challenges of creating rich GUI web application. In this layer we have JSP pages and JSF components. All the request to the web server are passes through faces Servlet.
Business Layer
The POJO classes and classes to process the business logic are used to create the Business Layer. The POJO classes with the help of spring framework creates an ideal solution to implement the Business Layer.
Data Access Layer
The data access layer handles all the logic to save and retrieve the data from data base. Hibernate O/R mapping tools is an ideal solution for enterprise application of any size. Hibernate handles all the logic to store and retrieve POJO objects. It also handles resource management and transaction management activities.