-->
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: the query cache
PostPosted: Thu May 26, 2005 8:27 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
hi



in the tutorial (page 170) there is:
hibernate.cache.use_query_cache true

then :
List blogs = sess.createQuery("from Blog blog ")
.setMaxResults(15)
.setCacheable(true)
.setCacheRegion("frontpages")
.list();



My question is:
How can i retrieve what is in the cache? How can I work with?

thanks

julien


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 9:20 am 
Regular
Regular

Joined: Tue May 24, 2005 10:19 am
Posts: 65
From documentation:" Query result sets may also be cached. This is only useful for queries that are run frequently with the same parameters".
Hibernate reuse de query results. Is not necessary get the cache contents.
see : http://www.hibernate.org/hib_docs/reference/en/html_single/#performance-querycache


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 9:29 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
zesj wrote:
From documentation:" Query result sets may also be cached. This is only useful for queries that are run frequently with the same parameters".
Hibernate reuse de query results. Is not necessary get the cache contents.
see : http://www.hibernate.org/hib_docs/reference/en/html_single/#performance-querycache





ok thanks but I don't uderstand what thats means and how can iwork with it.

please help me


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 10:29 am 
Regular
Regular

Joined: Fri Sep 17, 2004 10:51 am
Posts: 61
Location: Rimini, Italy
Set hibernate.show_sql true and try to execute your method. You'll find that Hibernate generates a SQL statement (and executes it) to fulfill your request, in your example getting all Blog objects.
If you execute the same method another time, no SQL is executed and data is simply taken from cache.
You don't have to worry about cache management.

_________________
--
Marco


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.