Oliver Weiler [
http://community.jboss.org/people/helpermethod] created the discussion
"Understanding JBossCache - Caching an object graph with many associations"
To view the discussion, visit:
http://community.jboss.org/message/618113#618113
--------------------------------------------------------------
I'm trying to use JBossCache as a JPA/Hibernate 2nd level cache provider to cache
repeatedly called queries. The queries return entities of a specific type, lets call it
FooType.
FooType looks like the following:
@Entity(name = FooType)
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public class FooType {
protected BarType barType;
@ManyToOne(targetEntity = BarType.class, cascade = { CascadeType.ALL })
BarType getBarType() {
return barType;
}
}
So, Footype has a many-to-one association. Now, when I call the query, only a very small
part seems to be put in the cache. I think the reason is because I didn't mark the
association with the @Cache tag. Am I correct?
But the real question is:
BarType also has a handful of associations, and these return objects which also provide
associations and so on, building a big graph of associations. Now, do I need to
a) annotate all of those classes and b) also annotate the associations
in order for the whole query to be cached?
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/618113#618113]
Start a new discussion in JBoss Cache at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]