After doing some reading, I realized that in GAE datastore, an entity
is stored using the key value and a key name or ID. The key name has to
be a string and the ID is long. The key name can be created by the
application and can be created like this as an example:

Key key =
KeyFactory.createKey(Employee.class.getSimpleName(), 
"alfred.sm...@example.com");

The ID can only be created by the datastore, so we have to leave it
with a null value.
Now, when we want to retrieve-fetch an object from datastore, we have
two different situations. First, if we had created
the entityid with key name, we can retrieve the object by recreating
the key with the above syntax and then search for
the object using
Employee e = pm.getObjectById(Employee.class, k);
But if we have used the numeric ID, we can' t look for it using the
KeyFactory, as usually humans don' t search an
object using numbers, but easily remembered strings. So we have to use
a query.
In my question, I have to use a query.
If I am somewhere wrong, please inform me.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to