-->
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.  [ 1 post ] 
Author Message
 Post subject: Query cache does not update L2 object cache
PostPosted: Fri Feb 22, 2013 7:38 am 
Newbie

Joined: Fri Feb 22, 2013 6:22 am
Posts: 1
When configuring query cache and second level object cache I came across a behavior which I don't know if it's a bug, a missing feature or just a misconfiguration of the cache.

1. Assuming all caches all empty, we run a query. The ids of the returned objects are stored in the query cache and the objects are stored in the L2 object cache. Great so far.
2. Now, the query cache expires before the object cache does. The query is re-ran and the ids of the returned objects are cached in the query cache.
3. The object cache expires. The query cache is still valid, so the ids are returned from the query cache. Unfortunately, the objects are no longer cached and hibernate fetches them all one-by-one, which takes forever.

Now the question: Why doesn't the query cache update the objects returned in step 2? The objects were fetched form the database, so we have a fresher version of them and an update of the L2 object cache could be performed. This way, the object cache wouldn't expire in step 3.

If this is the correct behavior then how can I configure the timeout values of the query cache and L2 object cache to avoid the one-by-one fetching of objects?
* When the query cache expires first, it won't cache the objects (as described), which will eventually lead to a situation where the query cache is valid and the object cache expired.
* When the object cache expires with the query cache still valid, hibernate performs a one-by-one fetching of all objects that are returned by the query cache.

PS: I've also described the issue here in more details: http://stackoverflow.com/questions/14987050/hibernate-cache-are-objects-returned-by-a-cached-query-stored-in-l2-cache


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

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.