• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the difference between HttpSession and Hibernate Session?

 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please give the links if we have some good articles especially which suggests the differences .Thanks.
 
Ran Pleasant
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sasank manohar wrote:Also please give the links if we have some good articles especially which suggests the differences .Thanks.


A HttpSession created when you log onto a servlet base web application, it is your user session while you are in the application. The HttpSession exists as long as you are logged onto the application. A Hibernate session is created by Hibernate when you use Hibernate to read and/or write objects to a database. The Hibernate session exist only for the duration of a transaction. If you ask Hibernate for several sessions during a single transaction it will (should) give you the same session. If you ask Hibernate for a session in two different transactions it will (should) give you two different sessions. While you are log into an application with a single HttpSession you may perform many actions that result in Hibernate creating many many session.

Of course the above assumes the application was build using both Servlets and Hibernate.

Hope that makes sense.
 
sasank manohar
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ran that makes a lot of sense for me. thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic