Reputation: 1188
If i've annotated a string variable in my JDO to be used as the id e.g.
@Id
private String nameOfId;
And in the appengine's console it's named as 'NAME/ID', what do I use to get the property
Note: For my queries, I'm using the datastore's query and not the entity manager, this means a collection of entities are returned to me and i've to get it's properties using, 'getProperty("propertyName")'
Also Note: ive tried the following names
getProperty("id");
getProperty("Id");
getProperty("name");
getProperty("NAME");
getProperty("NAME/ID");
getProperty("nameOfId");
none of these worked, I would just like to know what text I need to put as my argument for the getProperty method
Upvotes: 0
Views: 71
Reputation: 2111
The ID is not a property of the entity, it is a part of the entity key. It appears in the Console as a column only to help identify the entity.
To get the string ID from a com.google.appengine.api.datastore.Entity
, call its getKey()
method to return a Key
, and call the key's getName()
method.
Upvotes: 3