-->
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: EHCaching and Inheritance?
PostPosted: Sat Jul 21, 2007 1:55 pm 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
I've found a small gap in the documentation and/or functionality, and I'm curious what the behavior is in the following situation:

1. The Hibernate POJO model uses inheritance.
2. You wish to tune to EHCache settings specifically for subclasses.

In my experiments, the cache names are set as the subclasses, however, when tested, those caches are empty, whereas a cache named for the superclass is the one being populated and used.

What are the semantics here? In what order, or with which parameters do I specify to EHCache that Hibernate should use the subclass caches? Or can I?

Example:

Code:
public class Fragment extends Asset {
//...
}


Code:
public abstract class Asset {
//...
}


Code:
  <cache name="com.sourcemedia.webpub.cms.model.content.Fragment"
    maxElementsInMemory="1000" eternal="false" overflowToDisk="true" timeToIdleSeconds="120" timeToLiveSeconds="180" diskPersistent="false" memoryStoreEvictionPolicy="LFU" />


Code:
  <cache name="com.sourcemedia.webpub.cms.model.content.Asset"
    maxElementsInMemory="200" eternal="false" overflowToDisk="true" timeToIdleSeconds="120" timeToLiveSeconds="180" diskPersistent="false" memoryStoreEvictionPolicy="LFU" />


I've tried reversing the order of the two cache elements, and having just the first on its own. When it was the latter, there still was a cache named ...*.Asset, even though I had not specified it. Odd. Acts like it doesn't allow subclasses to have their own caches.

Hibernate version: 3.2.4.sp1
Mapping documents: None (Annotations)
Name and version of the database you are using: MySQL 5.0.27


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 25, 2007 12:17 am 
Beginner
Beginner

Joined: Thu Oct 16, 2003 7:25 pm
Posts: 38
Location: New York City
Anyone at all? How come the tough questions never get answered? I feel like a journalist, concerned about the misuse of power by an American president.


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.