gwt - RequestFactory's Entity Relationships -
the details of request
's with() implementation of requestfactory
in gwt
bit unclear me. see here the official documentation.
question 1:
when querying server, requestfactory not automatically populate relations in object graph. this, use with() method on request , specify related property name string.
does mean if entity
@ server uses lazy fetching
, returned entityproxy
have requested objects specified in with()? seems bit odd instantiate whole object graph of object server side, send small piece client.
question 2:
does req.with("foo").with("foo"); same req.with("foo"); ?
question 3:
does req.with("foo").with("bar"); same req.with("foo","bar"); ?
note: i'm having hard time finding implementation details of with() in source code , api doesn't me either.
question 1:
it depends on server side implemenation. with
invocation make sure corresponding getter (getfoo()
) called shortly before rf
call returns client.
that's reason why have make sure use opensessioninview
pattern, otherwise might run nullpointeterexception
s.
question 2:
i guess request<t>
implements builder pattern. end-result same. not sure if getter()
called twice or if with
method check if getter requested.
question 3:
yes it's same.
as sidenote. can use req.with("foo.bar")
. on backend lead getfoo().getbar()
call.
Comments
Post a Comment