thank you for reply

> You can let app engine choose a unique key for you
I have several fields which must be unique because of business
logic.how can app engine make the unique key for the several fields?

>or use a  transaction to first query for an existing value and then put it 
>only if it does not already exist
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?

On Feb 5, 10:06 pm, John Patterson <[email protected]> wrote:
> You can let app engine choose a unique key for you or use a  
> transaction to first query for an existing value and then put it only  
> if it does not already exist.  In order to do the query and put in a  
> transaction the entities must all be in the same Entity group which  
> will reduce concurrency.  If you can partition your unique values  
> somehow (e.g. A-D, E-H...) then you can have a root entity for each  
> partition to decrease contention.
>
> On 5 Feb 2010, at 17:41, smile laugh wrote:
>
> > would someone be so kind to give me an answer.
>
> > thanks
>
> > On Feb 4, 1:20 am, smile laugh <[email protected]> wrote:
> >> I have another question.
>
> >>  to a unique field which cannot have same value, before I insert a
> >> record , I must check if there is same value in the field.
>
> >>  it seems impossible to make the constraint in cloud platform.
>
> >> because when I insert the record , maybe other one can insert the  
> >> same
> >> record at the same time. that will break uniqueness of the field .
>
> >> thanks in advance
>
> >> laughsmile
>
> > --
> > 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 
> > athttp://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 [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