-->
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: Is an entity marked as lazy="true" cached?
PostPosted: Fri Jan 05, 2007 8:12 am 
Newbie

Joined: Tue Dec 12, 2006 9:07 am
Posts: 13
Can someone confirm my observation below?

Does hibernate cache an entity marked as cacheable and lazy (default configuration for a class with hibernate 3.x) ?

From my observation, if I mark an persistent class as lazy="false" in hbm.xml ,
the entity is stored and fetched from cache when invoked through apis like load() , iterate() , etc;
otherwise it is not.

Is this the way its meant to be?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 1:41 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Err, if I read your question correctly at first glance I'd answer no. But are you speaking about first or second level cache? If first one, then, no. lazy of eager loading is not related to caching or not.

Simply, instances are just cached in the first level cache after having been retrieved.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 6:25 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
I understand you are asking about the second level cache.

I think lazy attribuet is not related with cache behaviour.

lazy entities will use proxies to evict unnecessary loads. Non lazy entities will always load their content when accessed.

Cache (2L) is used when loading an entity by their id. That can be a non lazy entity or a proxy (lazy) entity when accessing its properties (so, it needs to access its state by-passing proxy)

Please correct me if I'm wrong


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.