If you use a transaction to retrieve the entity by key (the URL) and then 
create one if it doesn't exist, only one entity should be successfully 
created in the event of a collision. Therefore, even if you create two 
different versions with different unique ids, only one should survive.

On Tuesday, August 7, 2012 8:08:42 AM UTC-4, Neo wrote:
>
> Hi Jeff, 
>
>
> Actually my requirement is that , Whenever I save a new entity, the id 
> field should get autogenerated. If I have to do it on my own (as  you 
> suggested DatastoreService.allocateIds()), how do we handle scenarios like 
> two threads on different machines trying to store the newly created entites 
> in the datastore (thereby trying to assign different ids). I am not well 
> versed with all the concepts. If you can please elaborate, that would be 
> really useful. And you are right in guessing that I need the shortest 
> possible value. Hashes, I suppose are not guaranteed to be unique for two 
> different arbitrary strings.
>
> Thanks,
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/-zhJp8r7laMJ.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to