-->
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: Second level cache and collection prperties
PostPosted: Thu Dec 29, 2005 10:01 am 
Newbie

Joined: Mon Dec 05, 2005 10:02 am
Posts: 12
Hello All

I have an entity called country which has a collection of State objects mapped to it using one-to-many. For the cache test I disabled lazy loading.
For testing second level cache (SysCache implementation) I have written a small program that do the following process twice for the same state:
1. create a session
2. load the country using session.load()
3. Iterate over the states and pring them
I expected that in the second time I do this action all the relevant data will be read from the cache.
In fact, what happens is that only the country itself is found in the cache while the states are re-read from the database.
Looking at the log I see that during the first time the data is read both the country and the states are saved in the cache but in the second time I get a cache hit only for the country and it looks like the states are added to the cache once again.

I read about cache in query or load operation, but what is the behavior when initializing collections?

Thanks In Advance
Dror


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2005 10:14 am 
Senior
Senior

Joined: Sat May 14, 2005 8:40 am
Posts: 130
Did you add a <cache ...> element to mapping of the states collection?

_________________
Cuyahoga


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2005 10:41 am 
Newbie

Joined: Mon Dec 05, 2005 10:02 am
Posts: 12
That's exactly it!
Thanks martijnb for your quick and accurate reply.


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.