Earlier, I created my entities this way:
Entity entity = new Entity("Person", personName);
. Which means the ID/Name of this entity will be personName.
Now, I've decided to use Objectify. So I've created a Person.java
class to represent this entity.
My question: how can I retrieve the key (either a com.google.appengine.api.datastore.Key
or the raw string representation) of the entity using Objectify? Previously, I was able to simply do a personEntity.getKey()
. But I'm still trying to figure out how to do that with Objectify after using it to wrap around the Low Level Datastore API.
Key
? The whole idea of Objectify is to hide the Datastore so you can deal with POJOs that have e.g. aLong id
. Also makes things easier to test compared to using the classes in thec.g.appengine.api.datastore
package. – Philipp ReichartKey
. – tommi