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.  [ 5 posts ] 
Author Message
 Post subject: StandardQueryCache remains empty
PostPosted: Tue Jan 13, 2009 12:37 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 3:54 am
Posts: 28
Hi,

I would like to cache the results of a Named Query, but org.hibernate.cache.StandardQueryCache.data remains empty. I've been reading through the documentation and forums and I think that my configuration is correct. The maxElementsInMemory property has been explicitly set to a low value (1) to enforce Hibernate to use the file.

I would be pleased if someone could help me with this (simple) caching configuration :o).

SessionFactory
Code:
            <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.use_sql_comments">true</prop>
            <prop key="hibernate.generate_statistics">true</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.cache.use_second_level_cache">true</prop>
            <prop key="hibernate.cache.use_structured_entries">true</prop>


Named Query
Code:
<sql-query name="getDashboardItems">
      <return alias="dashboardItem" class="..."/>
...   </sql-query>



ehcache.xml
Code:
     <cache name="org.hibernate.cache.StandardQueryCache"
         maxElementsInMemory="1"
         eternal="false"
         timeToIdleSeconds="120"
         timeToLiveSeconds="120"
         overflowToDisk="true"/>



Regards, Stefan Lecho.

Hibernate version:
3.2.5.ga


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 5:08 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Did you make your Query cacheable?

q.setCacheable(true);

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 5:34 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 3:54 am
Posts: 28
Yes.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 5:35 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 3:54 am
Posts: 28
Yes.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 5:37 pm 
Beginner
Beginner

Joined: Wed Aug 27, 2003 3:54 am
Posts: 28
Yes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.