-->
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.  [ 1 post ] 
Author Message
 Post subject: Caching only some instances
PostPosted: Wed Aug 24, 2011 8:35 am 
Newbie

Joined: Tue Aug 23, 2011 5:05 pm
Posts: 4
Is it possible to cache only some instances of an entity? For example if I have a CMS (Content management system) with a dynamic menu. Then I would have a MenuItem entity, which I would like to cache, because the menu items don't change much and are needed for every page. A MenuItem would have a property to the Page entity it is linking to. What I would like to do is cache just those pages that are referenced from a MenuItem.

A tried making a subentity of Page and only add an org.hibernate.annotations.Cache annotation to the subentity. The idea was that the pages referenced from MenuItems would be of this subentity. However this did not work, because subentities always have the same caching strategy as their root entity. So is there perhaps another way of specifying which instances you would like to cache? For example there is a way to evict specific instances from the cache, so maybe you can add specific instances to the cache and then tell Hibernate to stop automatic caching for that entity? Sadly I could not find anything like this.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.