Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Long Session and First Level Cache behaviour

 
Adrian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are working on a Web Application project, using the concept of "long sessions".
In this process we experienced an unexpected behaviour of the Hibernate Session:

- we store the Hibernate Session in the HttpSession.
- in consecutive requests we are connecting and disconnecting from the Hibernate Session.

- we were expecting that an object, once loaded in the Hibernate Session, will remain loaded as long as the Session is not closed.

However we found out that this is true, only when the "think time" is very short.

If "think time" is longer, when we reconnect to the session in the next request, the object is no longer available and a new database query is issued.

Is this the intended behaviour of Session cache, or we are doing something wrong?
 
Adrian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...after one more review of the code --> beginners mistake in the HibernateUtil class.

Session Cache works perfectly!!!
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Adrian"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic