db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <ar...@code-au-lait.de>
Subject Re: Assertion in org.apache.ojb.broker.accesslayer.ReferencePrefetcher
Date Fri, 02 Jan 2004 15:52:57 GMT
Hi Andy,

by the way, are you working on a IdentityWeakHashMap implementation 
based on commons-collection ReferenceMap?
I'm too busy to write this code.
I will check in a workaround for the AnomymousField-Identity problem 
using an Identity wrapper today.

regards,
Armin


Andy Malakov wrote:
> Hello All,
> 
> Is it possible to add an assertion into the method 
> 
> ReferencePrefetcher.associateBatched(Collection owners, Collection children)
> 
> that will validate that all parent objects that have non-null children foreign keys found
their children?
> 
> 
>         for (Iterator it = owners.iterator(); it.hasNext(); )
>         {
>             owner = it.next();
>             fkValues = ord.getForeignKeyValues(owner,cld);
>             if (isNull(fkValues))
>             {
>                 field.set(owner, null);
>                 continue;
>             }
>             id = new Identity(null, topLevelClass, fkValues);
> +           boolean childFound = false;
>             for (Iterator it2 = children.iterator(); it2.hasNext(); )
>             {
>                 relatedObject = it2.next();
>                 id2 = new Identity(relatedObject, pb);
>                 if (id.equals(id2))
>                 {
>                     field.set(owner, relatedObject);
>  +                  childFound = true;
>                     break;
>                 }
>             }
> 
> +          if ( ! childFound) 
> +              throw new SomeKindOfException ("ReferencePrefetcher.associateBatched()
Unresolved reference: " + owner + "->" + id);
>         }
> 
> 
> I believe that there is some intermittent problem with batch loading that appears as
lost children.
> (2Armin: this happens even with WeakIdentityHashMap)
> 
> 
> Thanks,
> Andy
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message