-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: EHCache and memory management
PostPosted: Wed Apr 21, 2004 11:31 am 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hy there !! =)

I'm practiving EHCache with Hibernate...and I would like to know something.
Here are my problem :
I have a class MyClass. Its mapping file declares it cached in 2ndLevel EHCache cache.
We have one Hibernate session by user (by HTTPSession). Now, imagine two users.
The first one call a hibernateSession.iterate(hqlQuery). It loads the data from the DB and put it in the 2ndLevel cache. Ok. Now, the second user comes and call hibernateSession.iterate(hqlQuery). I see in the log that it loads all the data from the 2ndLevel cache. Ok. That's all what I want for now. BUT, FROM HERE IS MY PROBLEM.
In each session, if I wanna get the object with the same id and I make a System.out.println(myObject.toString());, I see that it's not the same object in memory (it's not the same adress after @).

So, is it right ? Does this 2nd Level cache not share the objects in memory but gives clones to requesters ?

From this point I have another problem. When my first user make an update then commit on an object, the second user doesn't see the change in his HTTPSession. Do I have to make a hibernateSession.refresh(myObject); ?

Thank you !! and sorry for this pandemoniumic topic... ;o)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 6:20 pm 
Newbie

Joined: Wed Apr 21, 2004 12:45 am
Posts: 11
Did you every find a answer to this question? I am wondering this as well.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 9:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yes, of course the second-level cache works this way.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.