I'm using Objectify 5.0.5, Objectify-GWT 1.2, GWT 2.6.1 and App Engine SDK 1.9.10.
I'm trying to do some very basic stuff with GAE, GWT and Objectify. I've done some things in GAE before and now I thought I should see if I can speed up production a bit by using Objectify but I'm climbing hurdle after hurdle. I'm not sure if I'm doing something wrong or if there's a bug in the library.
So here's my problem in general: I'm trying to use Ref.create(someEntity) on the client-side in GWT but it fails and prints:
Invalid type signature for com.googlecode.objectify.impl.ref.DeadRef
I've got the following entities/models:
@Entity
public class Persistable implements Serializable{
private static final long serialVersionUID = 7733004846243513450L;
@Id
Long id;
public Persistable() {}
public void setId(Long id) {
this.id = id;
}
public Long getId()
{
return id;
}
public void persist()
{
//This is actually a "remote service" and the only thing it does is call:
//ofy().save().entity(entity);
PPServices.getBasicService().persist(this, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {}
@Override
public void onSuccess(Void result) {}
});
}
}
@Subclass
public class Event extends Persistable{
private static final long serialVersionUID = 1L;
Ref<PPUser> host = null;
public Event(){}
public void setHost(PPUser participant)
{
host = Ref.create(participant);
}
}
@Subclass
public class PPUser extends Persistable{
private static final long serialVersionUID = 1L;
public PPUser(){}
}
And I use them as following:
public class EntryStuff implements EntryPoint{
public void onModuleLoad() {
final Event event = new Event();
final PPUser user1 = new PPUser();
event.setHost(user1);
event.persist();
}
I can't see what's wrong. Even if I manually give user1 an ID it won't make any difference at all. Am I forced to set the host-field on the Server-side or what? In JDO I just create a new instance of PPUser and assign it and then persist/save the entity (in this case the Event) and it (PPUser) will be created, isn't the same possible here? :/