-->
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: Query Cache
PostPosted: Wed Feb 02, 2005 9:10 am 
Newbie

Joined: Wed Feb 02, 2005 8:52 am
Posts: 2
Hi
I'm using ehcache for caching the query results using th flg code ...

<!--In ehcache.xml-->
<cache name="query.ABC"
maxElementsInMemory="5"
eternal="false"
timeToLiveSeconds="86400"
overflowToDisk="true"/>

and in java class i added the flg code

query.setCacheable(true);
query.setCacheRegion("query.ABC");

<!-- In hibernate.cfg.xml-->

<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.query_cache_factory">net.sf.hibernate.cache.StandardQueryCache</property>

I'm able to create cache but unable to find solution to retrieve the results from cache... anybody can help... Thanks in advance...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 9:53 pm 
Beginner
Beginner

Joined: Sat Jan 22, 2005 9:11 am
Posts: 35
Location: London
You need to set the class you are querying for to be cacheable too.

Use the <cache> element in the class mapping file.

HTH,

Ben


Top
 Profile  
 
 Post subject: Query Cache
PostPosted: Thu Feb 03, 2005 1:56 am 
Newbie

Joined: Wed Feb 02, 2005 8:52 am
Posts: 2
Hi,
I've also placed the cache tag in class mapping file...my query results are being cached...but I need to retrieve them from the cache.. which I'm unable to do it....Is there any API to retrieve results and display the list.


Top
 Profile  
 
 Post subject: Re: Query Cache
PostPosted: Thu Feb 03, 2005 7:08 am 
Senior
Senior

Joined: Tue Aug 03, 2004 2:11 pm
Posts: 142
Location: Somerset
suneelkumar wrote:
Hi,
I've also placed the cache tag in class mapping file...my query results are being cached...but I need to retrieve them from the cache.. which I'm unable to do it....Is there any API to retrieve results and display the list.


Isn't the idea that if you cache the results, it's transparent as far as the application code is concerned ? You cache the results, so that next time you do the query, it gets them from the cache rather than the database.

_________________
On the information super B road


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.