Comment 6 for bug 786418

Revision history for this message
Scott Ritchie (sritchie) wrote : Re: [Bug 786418] [NEW] Removal of an object doesnt manage entity keys

No the remove() methods in the ServiceImpl are missing those calls
altogether. It simply deletes the one in the datastore without maintaining
the relationship.

On Tue, May 24, 2011 at 9:14 PM, Prageeth Silva
<email address hidden>wrote:

> I think I know why this is happening. As far as I can remember, when
> we introduced the keys, i remember rechecking the relationships.
> However, what I missed was something along the lines:
>
> Set<Key> list = ....
>
> public void remove(ModelClass object) {
>
> this.list.remove(obj);
>
> }
>
> The above code will not work as Matt mentioned the other day. Key ==
> Key will fail since the references are different. AFAIK list.remove()
> removes an object by reference.
>
> I think what's needed here is to loop through (not using for each
> case) and check IDs and remove appropriately.
>
> We can have a common method to handle this (parameters being a set of
> keys and a key) since this would be used in many cases.
>
> --
> *Prageeth Silva*
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/786418
>
> Title:
> Removal of an object doesnt manage entity keys
>
> Status in Melbourne University Game-based Learning Environment:
> In Progress
>
> Bug description:
> When removing an object from the datastore, the corresponding keys in
> other classes are left there.
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/mugle/+bug/786418/+subscribe
>