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 #2public 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 #3Request<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