Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7165433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:14:19+00:00 2026-05-28T14:14:19+00:00

If I arbitrarily set the id of a new entity to 1000 , without

  • 0

If I arbitrarily set the id of a new entity to 1000, without using allocateIds first, could a later entity be automatically given the id 1000 and overwrite my original entity?

In pseudocode, if I have:

Entity e1;
e1.setId(1000);
datastore.put(e1);

… later…

Entity e2;
datastore.put(e2);

Is there any chance e2 will automatically be given the id 1000 and overwrite e1?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:14:19+00:00Added an answer on May 28, 2026 at 2:14 pm

    As explained in the Java API documentation

    Creating an entity for the purpose of insertion (as opposed to update)
    with this constructor is discouraged unless the id was obtained from a
    key returned by a KeyRange obtained from
    AsyncDatastoreService.allocateIds(String, long) or
    DatastoreService.allocateIds(String, long) for the same kind.

    See also the Python documentation:

    Be aware, however, that the datastore is not guaranteed to avoid app-assigned IDs. It is possible, though unlikely, that the datastore will assign a numeric ID that will cause a conflict with an entity with an app-assigned ID. The only way to avoid this problem is to have your app use allocate_ids() to obtain a batch of IDs. The datastore’s automatic ID generator will not use IDs that have been obtained using allocate_ids(), so your app can use these IDs without conflict.

    You should not be creating entity with ids that have not been allocated by the datastore, if you want to supply an user defined identifier as part of the Entity key, use key_name instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an arbitrarily nested data structure, how can I create a new data structure
The ExpandoObject class being added to .NET 4 allows you to arbitrarily set properties
Clojure structs can be arbitrarily extended, adding new fields. Is it possible to extend
I have an application that contains methods that work with data using Entity Framework
Basically I want an arbitrarily large stack. I know that's not possible, but could
I have to solve the following optimization problem: Given a set of elements (E1,E2,E3,E4,E5,E6)
How to set an arbitrary HSLA color instead of gray20 ? draw = Magick::Draw.new
I am trying to display a set of data using a DataTemplate in an
I'm using the .NET SDK and attempting to tag a new instance immediately after
Below is a first attempt at using a Composite pattern. It works in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.