-->
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: How to setup Hibernate query cache.
PostPosted: Sat Nov 04, 2006 9:54 pm 
Newbie

Joined: Sat Nov 04, 2006 3:52 pm
Posts: 1
Hi,

I have setup hibernate query cache. But when I execute the
same query multiple times, it still go and query the database (from
the hibernate sql out in the console, it still executes mysql query).

Can you please tell me what am i missing?

Here is why I did in my hibernate.cfg.xml file:

Add these:
<property name="cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<property name="hibernate.cache.use_query_cache">true</property>

And then, here is my query:
Query query = session
.createQuery(
"from Country as country where country.language= :language and
country.phone.id = :phoneid");

query.setString("language", language).setLong("phoneid",
phone.getId().longValue());

query.setCacheable(true);
// uncomment this still does not work.
// query.setCacheRegion("query.Builds");

List result = query.list();


Can you please tell my how to get ehcache to work as hibernate query cache.
I think I have followed what the documentation said. But it still does not work.

Thank you.


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.