Think you need to add 'with("payload") to your RF request in the
client side code..

Request<ItemProxy> req = this.itemRequestContext.saveAndReturn(item);
to
Request<ItemProxy> req =
this.itemRequestContext.saveAndReturn(item).with("payload");



On Sun, Sep 11, 2011 at 4:34 PM, Julian <julian.petter...@gmail.com> wrote:
> Hi there
>
> I'm having some difficulties using RequestFactory (and Objectify). I have
> two entities Item and Payload, and corresponding proxies ItemProxy and
> PayloadProxy (#1). If I call ItemRequestContext.saveAndReturn() on the
> clientside (#3) a simple println in my ItemDao shows the Payload as having
> an id (#2). But when the Response reaches the client side, the Payload is
> just null.
>
> Is there some obvious reason why the Payload doesn't make it to the client
> side, given the code snippets below?
>
>
> CODE SNIPPET #1
>
> @Entity
> public class Item extends DatastoreObjectGenerated {
>
>    private Key<Payload> payloadKey;
>    @Transient
>    private Payload load;
>
>    public Item() {
>    }
>
>    public void setPayload(Payload load) {
>       this.load = load;
>    }
>
>    public Payload getPayload() {
>       return this.load;
>    }
> }
>
> @ProxyFor(value = Item.class, locator = ObjectifyGeneratedLocator.class)
> public interface ItemProxy extends DatastoreObjectGeneratedProxy {
>
>    public void setPayload(PayloadProxy load);
>
>    public PayloadProxy getPayload();
>
> }
>
>
> @Entity
> public class Payload extends DatastoreObject {
>
>    public Payload() {
>    }
> }
>
> @ProxyFor(value = Payload.class, locator = ObjectifyLocator.class)
> public interface PayloadProxy extends DatastoreObjectProxy {
>
> }
>
>
> CODE SNIPPET #2
>
> public class ItemDao extends ObjectifyDao<Item> {
>
>    public Item saveAndReturn(Item item) {
>
>       ...
>
>       Item it = getItem(item.getId());
>       System.out.println("Payload ID: " + it.getPayload().getId());
>
>       return tr;
>    }
> }
>
> // PRINTS
> // Payload ID: 18
> CODE SNIPPET #3
>
> Request<ItemProxy> req = this.itemRequestContext.saveAndReturn(item);
> req.fire(new Receiver<ItemProxy>() {
>    @Override
>    public void onSuccess(ItemProxy response) {
>       System.out.println("Payload ID: " + response.getPayload());
>    }
> });
>
> // PRINTS
> // Payload ID: null
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/THZWXQKKy0AJ.
> 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.
>

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