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 Thomas Mahler <th...@web.de> on 2003/04/12 10:35:09 UTC
[FAQ] Re: ObjectCacheEmptyImpl regurgitating
Hi Jason,
The Problem you see is due to circular references in your data.
Say A references B and B has a backreference to A.
Now we load A from the DB. If autoretrieve="true" for the
reference-descriptor describing the reference to B, OJB will also load B.
If autoretrieve="true" for the B-reference-descriptor describing the
back-reference to A, OJB must retrieve A.
And here is the key point.
If we use the defaultcache A will be in the cache already, as it was
loaded first. So OJB will simply lookup A from the cache. No endless
recursion!
But if we use the emptycache, A will not be cached. So OJB must load A
from the DB. And then again B is retrieved, etc., etc.
There's you endless recursion.
In other words: A non-empty cache is needed to allow proper loading of
circular references. (Other O/R tools like TopLink work the same way).
If you still want to use the EmptyCacheImpl you should set
autoretrieve="false" and load references explicitely by
broker.retrieveReference(...).
cheers,
Thomas
Jason McKerr wrote:
> I just tried to turn caching off by using ObjectCacheEmptyImpl setting
> in ObjectCacheClass, and it seems to continuously loop through the SQL
> statement infinitely. The default works fine though.
>
> Any ideas why this might be?
>
> Jason
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>