I also have collections of EntityProxys, but I make the lifetime of
the collection the same as the lifetime of the RequestContext.

So after I do a CRUD operation, I refresh my collections in the new
RequestContext, and therefore don't have any inter-RequestContext
problems.


On Nov 14, 2:01 pm, Hilco Wijbenga <hilco.wijbe...@gmail.com> wrote:
> On 14 November 2011 08:47, Hilco Wijbenga <hilco.wijbe...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On 14 November 2011 06:33, Robert Quinn <quinn.rob...@gmail.com> wrote:
> >> Equality works as Thomas mentioned, so one basic question leaps to
> >> mind: Why are you comparing EntityProxys from different contexts or
> >> with different stableIds?  Maybe there is a more centralized way you
> >> could manage those EntityProxys so that you are not dispersing them in
> >> various states/contexts across your app.
>
> > Firstly, I should have been more concerned about hashCode when working
> > with Sets but hashCode and equals go hand in hand and hashCode is part
> > of EntityProxyCategory as well.
>
> > The EntityProxy-s might be from different contexts but they are not
> > editable and all fields (including stableId) are the same. I checked
> > this. They all come from the database, through RF, so I have no
> > control over how many instances are created, AFAICT.
>
> > But I'm really confused now. I can see that equals/hashCode do what I
> > need them to do (i.e. compare stableId) but it's not working. Very
> > strange.
>
> Okay, so Robert was spot on. The problem is with RequestContexts. The
> set has a RequestContext (although I'm not sure why, AFAICT its
> onSuccess method has already run) and the proxy does not (i.e.
> BaseProxyCategory.requestContext(proxy) returns NULL).
>
> I'm sure there is a good reason for the RequestContext check in
> EntityProxyCategory.equals() but it seems more like a bug than a
> feature to me. Because of this extra check sets and maps no longer
> work as one would expect them to.
>
> How do I remove an EntityProxy from its RequestContext? There doesn't
> seem to be a close() method or similar on RequestContext. When is the
> RequestContext set to NULL? How do I get sets/maps to work again?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to