Hello all!

I have a datastore class "User", which has a property key of type Key
as its primary key.

Now, I want to store objects of type "Result" in the datastore, as
children of the User in an unowned relationship. Each result has a
property key of type Key as its primary key as well.

For creating the key of the child, I currently use the
Key.getChild(String kind, String name) method on the parent key (see
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Key.html#getChild%28java.lang.String,%20java.lang.String%29),
specifically like this:

Key key = user.getKey().getChild(Result.class.getSimpleName(),
UUID.randomUUID().toString());

The problem is, I'm quite sure that the UUID class doesn't guarantee
uniqueness in a distributed setting like GAE. Is there a way to
generate a unique name here, or preferably let the datastore handle
uniqueness? Like a Key.getChild(String kind) method.

Regards,
Markus

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to