You could use transactions if all Servers are in the same entity group. In a transaction you can query for existing A specifying the ancestor in the query. When you find no other Server with the key you can store it - also with the same ancestor - then commit the transaction. If another request saved the same key in between an exception would be thrown so you could try another key.

On 17 Feb 2010, at 11:58, smile laugh wrote:

hello everyone

I have several fields which must be unique because of business
logic.how can app engine make the unique key for the several fields?

For example, in a Server "A" ,I query a value and find there is no
existing value ,  so I insert value into Server "A" successfully.
But almost the same time , another one can do the same thing(insert
the same record) successfully in Server "B".
Because at this time , Server "A" and Server "B" are not consistent,
the prior inserts will all  be successful.

how can I avoid to insert the same records?

--
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-java@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 .


--
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