-->
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.  [ 4 posts ] 
Author Message
 Post subject: Cache miss with iterate() of Session
PostPosted: Thu Jul 21, 2005 3:21 pm 
Newbie

Joined: Thu Jul 21, 2005 3:14 pm
Posts: 6
I am using second level cache with Hibernate. EHCache is being used as second level cache. I am able to load my objects in cache using session.find() method. But when I try to use session.iterate() method to get objects from cache , I get Cache miss for every single object and iterate() method goes to DB for every object and load it.

Can somebody please inform me why iterate() method is getting a cache miss when all the objects are in second level cache? According to EHCache documentation, iterate() method always goes to cache to retrieve the objects.

I am using EHCache 1.1 and Hibernate 2.8.


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 3:25 pm 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
Have you implemented equals() and hashcode() on your entities? I never can remember all the details on these, but I remember they can affect caching if not implemented correctly.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 3:27 pm 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
http://www.hibernate.org/109.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 5:05 pm 
Newbie

Joined: Thu Jul 21, 2005 3:14 pm
Posts: 6
I am using both equals() and hashCode() methods but they are never being called.

I am getting following things:

sc.magistrate.data.Address cache - Miss

2005-07-21 17:01:21,017 DEBUG: Element for sc.framework.loadcache.Key@625b625b is null

2005-07-21 17:01:21,017 DEBUG: Cache miss

2005-07-21 17:01:21,027 DEBUG: object not resolved in any cache [sc.magistrate.data.Address#sc.framework.loadcache.Key@625b625b]



After this it goes to DB and try to load from there.

If anybody can provide any pointers etc.?


Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.