-->
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.  [ 4 posts ] 
Author Message
 Post subject: Default cache configuration
PostPosted: Sat Jun 26, 2004 11:34 am 
Newbie

Joined: Sat Jun 26, 2004 11:14 am
Posts: 6
Hi,
Is there a way, using hibernate.cfg.xml, to specify collection-cache for all persistent collections instead of having to specify each collection individually?

It seems that the collection attribute is required. Is there a wildcard setting for this attribute?

Thanks,
Eugene Stephens[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 12:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No. Caching all collections would be an antipattern.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 1:10 pm 
Newbie

Joined: Sat Jun 26, 2004 11:14 am
Posts: 6
Thanks Gavin.

I understand. Unfortunately, I am in an environment where I need to band aid a poorly performing application in short order, hence the Saturday hours. I am trying different caching scenarios and was hoping that there was a single place to turn it on and off as I do my benchmarking.

And this is a good enough segway into another question.

Is there a short answer to why I would get stale data from the cache? The scenario is as follows:

Class A has a persistent collection of Class B. The collection is cached. I add a new Class B to an instance of Class A and persist Class B without persisting Class A(the association is established via a reference from Class B to Class A). I run a query to get all instances of Class A. The instance of Class A with the new instance of Class B does not reflect the new association.

I am assuming that this happens because the relationship from A to B was never persisted therefore the cache does not get notified of the change to A. But what if an instance of B was also referenced by a Class C(and A) and deleted by the instance of Class C, and hence is not reachable from A? Would it have to also be deleted from the collection contained in A?

I hope that all makes sense.

Also, is there a document or FAQ that give some details about the cache framework?

Thanks again,
Eugene


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 26, 2004 1:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
For a bidi association, you must update *both* ends of the association, /while both objects are associated with the session/.


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