> Hi!
>
> I am playing around with new RequestFactory feature available in 2.1,
> and actually I think that I don't get the idea.
>
> At first i thought, that RequestFactory will bring me something like
> local domain model.
> Lets assume that entity A and proxy for it are present. Lets assume
> that this entity A has method getB() that returns entity B (proxy for
> this entity is also present). Now when I request for object A it is
> returned, but calling getB() causes "undefined" error. I would expect
> that this entity will be get from the server. Or I could load this
> entity B explicitly, but when I do this entity A still knows nothing
> about B. I can load again A with B, but this will give me whole new
> instance of A.
>
> I thought that it will be automatic or semiautomatic consistent local
> domain model.
>
> I cannot load all As with all Bs, because in my GUI user only selects
> one A, and for this A I will need its Bs. Getting all As and all Bs at
> start will cause loading lots of data. I need to build a model that is
> updated with new parts from server depending on what actions user
> takes.
>
> What am I missing?
"""
When querying the server, RequestFactory does not automatically
populate relations in the object graph. To do this, use the with()
method on a request and specify the related property name as a String:
Request findReq =
requestFactory.personRequest().find(personId).with("address");
"""
Source: http://code.google.com/webtoolkit/doc/trunk/DevGuideRequestFactory.html#relationships
In your case, you'd have to do a with("b"), as your property is named
getB(). it works the same whichever the type of the property (B,
List<B> or Set<B>).
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment