You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Nils Liebelt <ni...@candor.co.za> on 2005/05/17 11:47:58 UTC
OJB cache :: Best Practise
Hi all,
Having some trouble with the OJB caching. I use the default implementation
which should give a global cache for all Brokers.
My Business objects have a store() method that inserts/updates this object
towards the db and removes this object from the cache with the
removeFromCache() function. But the changed object still doesn't get newly
retrieved in relationships! Let's say I got an Account which has many
Contacts attached. If I change a Contact, store it and remove it from the
cache. The Account still has a reference to the old the account object? My
idea to solve it was an business function updateReferences() which needs to
be called from the "mother" object. But my OO-mind tells me that that's not
right. I don't want to pollute my simple BusinessInterface with complicated
things like that. So I could turn off the cache. Well not an option for me
or I could call the retrieveAllReferences() before retrieving which comes
close to turning off the cache. I wonder if there's not an nicer and more
clean way in doing so.
Regards,
Nils
mtgglf