In short, the value (proxy) is not updated before entity (proxy) on
the server side. So, the value is not updated correctly.

Detail:

Say I have entity E with a property V which uses ValueProxy. The
Entity E is fetched and updated like this:


        private void edit(RequestContext requestContext) {
                editorDriver = GWT.create(Driver.class);
                editorDriver.initialize(requests_factory, my_account_editor);

                if (requestContext == null) {
                        fetchAndEdit();
                        return;
                }

                editorDriver.edit(edit_response, requestContext);
        }

        void fetchAndEdit()
        {
                Request<MyEntityProxy> fetch_request=
requests_factory.MyEntityRequest().getMyEntity();
                fetch_request.with(editorDriver.getPaths());

                fetch_request.to(new Receiver<MyEntityProxy>() {
                        @Override
                        public void onSuccess(MyEntityProxy response) {
                                edit_response= response;
                                MyEntityProxyRequest edit_request=
requests_factory.MyEntityRequest();
                                edit(edit_request);   // the function is see 
below
                                edit_request.persist().using(edit_response);
                        }
                }).fire();
        }


This works fine until I update them on the server side by calling
"editorDriver.flush().fire(...)". The payload Json (as in
com.google.gwt.requestfactory.shared.impl.AbstractRequestContext::doFire())
looks like this:

{
  "I": [
    {
      "O": "banana.TestRequestFactory$MyEnityRequest::persist",
      "P": [
        {
          "S": "IjUi",
          "T": "banana.MyEntityProxy"
        }
      ]
    }
  ],
  "O": [
    {
      "O": "UPDATE",
      "S": "IjUi",
      "T": "banana.MyEntityProxy",
      "V": "MA==",
      "P": {
        "test_value": {
          "R": "1",
          "C": 1,
          "T": "banana.MyValueProxy"
        },
        "test_string": "m@m1",
      }
    },
    {
      "O": "PERSIST",
      "R": "1",
      "C": 1,
      "T": "banana.MyValueProxy",
      "P": {
        "foo": 1,
      }
    }
  ]
}

You see the problem?! MyEntityProxy is updated first!! MyValueProxy is
updated after Entity is saved to the database. So we lost the updated
value from the client side!

The corresponding code on the server side is in
com.google.gwt.requestfactory.server.SimpleRequestProcessor::processOperationMessages(final
RequestState state, RequestMessage req). the req message corresponds
to the JSON string.

How is the dependency/order handled here?

- Tom

-- 
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