Wednesday, May 25, 2011

Отг: Re: RequestFactory updating issue: update entity which has fields that are not listed in the proxy interface

I think that I found where is the problem. The problem is that I'm initializing my id locally and RF is checking whether you are doing that by using the EPHEMERAL placeholder. 

  /**
   * A placeholder value for {@link #clientId} to indicate the id was not
   * created locally.
   */
  public static final int NEVER_EPHEMERAL = -1;

So I have to load object first then I have to update it. The following change makes the things working:

 CustomerRequestFactory.CustomerRequest request = rf.customerRequest();
    request.findCustomer(1l).to(new Receiver<CustomerProxy>() {
      @Override
      public void onSuccess(CustomerProxy entity) {
        CustomerRequestFactory.CustomerRequest editRequest = rf.customerRequest();

        entity = editRequest.edit(entity);

        entity.setName("test test");
        entity.setVersion(2l);

        editRequest.store(entity).to(new Receiver<Void>() {
          @Override
          public void onSuccess(Void response) {

          }
        }).fire();
      }
    }).fire();

Are there are any workarounds which I can use to lie RF that request was loaded ?

In my case object is loaded as in the example, but proxy values are copied from one proxy to another due some old bugs with RF & Editor integration. It seems that this copy functionality is broking everything. 

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