-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate second level cache question
PostPosted: Mon Aug 25, 2008 5:07 pm 
Beginner
Beginner

Joined: Mon Jul 09, 2007 2:21 pm
Posts: 24
Will hibernate second level cache refresh itself if there is a change in the data of any of the database tables?

I understand that the second level cache will not be used if i have a select query not based on primary key. How do i make use of the second level cache for custom queries?

Example
Table1

ID (Primary Key) Name
1 x
2 y
3 z


the following hql query
"from table1 where name='x'" will hit the database everytime i execute it right?

i want to be able to get the results from the cache from the same query if i execute it the second time...i know there is query cache...but will the query cache work well when there is a change in the data?

Please help


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 7:11 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Quote:
Will hibernate second level cache refresh itself if there is a change in the data of any of the database tables?


How would the cache know the DB has been updated? You can, however, set the cache provider to expire data after a period of time. Or flush the cache yourself.

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 5:22 pm 
Beginner
Beginner

Joined: Mon Jul 09, 2007 2:21 pm
Posts: 24
i though hibernate has a mechanism to read some kind of a db statistics on tables to detect if there is any change and refresh the cache accordingly


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