I suggest using "getSelectedCountry().removeFromCenters(..)" for
consistent behavior. As for the remove, maybe we should fire a list
fault for consistency, but this hasn't been a big deal as
relationship management is better done via special methods.
Andrus
On May 24, 2007, at 10:54 AM, Alexander Lamb wrote:
> Hello list,
>
> I am fetching a "List" of objects (a too many relationship).
>
> Then in a loop, I am removing some objects:
>
> List<RegistryCenter> rcs = getRegistry().getRegistryCenters();
> List centers = getSelectedCountry().getCenters();
> for(RegistryCenter rc:rcs)
> {
> centers.remove(rc.getCenter());
> }
>
>
> Now, this doesn't always work. Actually, it fails if "centers" is a
> fault (I checked in the Cayenne code).
>
> If I simply do a "size()" of "contains" on the list before my loop
> for example. My list will fire and my loop will function correctly,
> removing objects when present in the list.
>
> So there is a workaround, but I was wondering why the "remove
> (object)" in ToManyList.java behaved differently than for example
> "remove(index)" which will correctly fire the fault.
>
> In other words, "remove(object)" is the only function which does
> not systématically fire the fault.
>
> Why?
>
> Thanks,
>
> Alex
>
>
This archive was generated by hypermail 2.0.0 : Thu May 24 2007 - 05:20:43 EDT