-->
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: Caching HQL query results
PostPosted: Wed Sep 03, 2003 12:50 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Hi all -
First, kudos to hibernate. Its the best.

My question - what would be a good (the best?) way to cache a set of objects defined by an HQL query?

As I understand it, if I execute a find() or iterate(), a query will always run to generate object IDs, but the objects themselves may be returned from a cache (per the jcs-cache configs).

I would like to define certain queries which would only be executed in certain cases - such as after an expiration period. I know the query results will rarely change, so I would like to avoid the db load incurred by this query whose results rarely changes.

I've thought about manually cache the results collection. After expiration, re-get the query result, and cache it again.

I've also thought about manually specifying the id set for the results, and just using those ids in the query, instead of restriciting the results within the query.

Is there some more elegant way to accomplish this within hibernate?

Thanks for any advice.
Tyson


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2003 9:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
To clarify:

* find() never returns objects from the cache
* iterate() always returns objects from the cache

If you wish to cache whole query result sets, do it at the application level.


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.