I want to know that which is better for the web application using:-
Spring3.1
Hibernate4
Hibernate session per request OR Hibernate session per application?
Please suggest
Thanks In Advance
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using session per request pattern is often a safe bet for any web application. It is maybe the most common pattern among all Servlet based applications.
When doing data manipulation we’ll use the same session during the whole request and in the end of the request make sure that session and transaction is properly finalized. When implemented properly, session-per-request pattern guarantees that number of Hibernate sessions is in control, sessions are properly closed and sessions are flushed regularly. A good combo of characteristics for a multi-user web application.
You will find lots of good article on google for benefits of hibernate session per request pattern.