I’m doing a simple asynchronous put operation with Objectify:
ofy().async().put(object);
This returns Result< Key< ObjectEntity>>, and I can call
Result<Key<ObjectEntity>> result = ofy().async().put(object);
And then I can call .get() on that to block until I get the result:
Key<ObjectEntity> objectKey = result.get();
But what can I do with this objectKey in order to get my object entity back? I basically want to be able to send this as an object back to GWT.
This should get your object back:
I tried my hands with Objectify a little so I’m definitely not an expert but you might want to make sure that if you’re putting an object into the datastore with an async put call, that you block until it has been inserted into the datastore before calling. If you’re going to end up needing to retrieve an entity immediately after inserting it, you’re defeating the purpose of using async.put().
Also you probably know this but the Objectify folks have done a decent job of putting together their API Javadoc for reference.