-->
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.  [ 2 posts ] 
Author Message
 Post subject: Query cache - session ?
PostPosted: Thu Dec 29, 2005 10:41 am 
Newbie

Joined: Tue Dec 20, 2005 12:36 pm
Posts: 2
Hello,

I turn on the second level cache and the query cache.

I have a question about query cache :

Here is the test I run :
- I make a query => the result is placed in cache
- I close my hibernate session
- I get a new session
- I execute the same query, Hibernate asks again the database => And here, I hope that the result woud be retrieved from the query cache

But if I make that way, it works :
- I make a query
- The result is cached
- I execute again the same query => And here, I hope that the result woud be retrieved from the query cache

Is it the way it should work ? only with the session still open ?


Top
 Profile  
 
 Post subject: setCacheable
PostPosted: Thu Dec 29, 2005 1:56 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Query cache is not in session scope.

http://www.hibernate.org/hib_docs/v3/re ... querycache
Quote:
Most queries do not benefit from caching, so by default queries are not cached. To enable caching, call Query.setCacheable(true). This call allows the query to look for existing cache results or add its results to the cache when it is executed.


_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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