An EntityProxy must have an ID and a version (getId() and getVersion() 
accessors on the server-side domain object, or possibly using a Locator if 
you can't have the getId and getVersion methods on the domain object).
This allows RequestFactory to dispatch EntityProxyChange events on the 
EventBus (version is used to detect whether the server-side object changed, 
and ID is used to... identify the object so you can match things on the 
client-side).
You can see this as a "by reference" argument passing, even though there's 
serialization involved to go through the wire.

On the other hand, a ValueProxy is just a data transfer object (DTO). Using 
only ValueProxy-s, you can use RequestFactory in a way similar to GWT-RPC, 
with the added benefit that you don't have *.gwt.rpc files to deploy, and 
all the headaches that go with it when developping; the main drawback being 
that it doesn't support polymorphism (yet).

When you send an EntityProxy to the server (for instance, to persist changes 
you made to it), the RequestFactoryServlet will first "find" the object from 
the database (or datastore or whatever you use) if it was previously 
retrieved from the server (i.e. it has a known ID and version, it was not 
created on the client in the same RequestContext) to then apply the changes 
by calling its setters, and finally pass it to the method you called (for 
instance, a "persist" method).
When you send a ValueProxy however, the RequestFactoryServlet always creates 
a new instance of the domain object, because there's no ID that can be used 
to reconcile the client-side object with an existing server-side object. The 
ValueProxy is serialized, send through the wire, and deserialized on the 
other side; it never "updates" an existing server-side object.

(communication from server to client is similar, when an EntityProxy is 
received from the server by the client, it updates a cached version of the 
EntityProxy with the same ID, if there's one)

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

Reply via email to