The URL I posted earlier in the thread explains it, but here's a little bit more detail:
A parent entity plus a kind defines an id-space, so entities with the same parent and the same kind are guaranteed to have unique ids. For example, if you have an Entity with Parent:A Kind: Person Id: 10 you are guaranteed that no other entity with Parent A and Kind Person will be assigned an Id of 10. However, an entity with a different Parent and Kind Person or an entity with Parent A and a different Kind _can_ be assigned an Id of 10. The datastore pre-allocates batches of ids across multiple servers under-the-hood, so you can't make any assumptions about the Id that will get assigned in terms of contiguousness. The only safe assumption is that the id will be unique for that Parent/Kind combination. Hope this helps, Max On Thu, Sep 10, 2009 at 5:29 AM, iker98 <ike...@gmail.com> wrote: > > Definitely I don't understand the number ID generator behavior across > kinds (in prod datastore). Does anyone know any URL with detailed > explanation about it? > > Thanks > > On Sep 9, 11:58 am, Tica2 <petrica.chir...@gmail.com> wrote: > > Max, > > > > I like to have same behavior between local and production environment > > > > It is posible ? > > > > For instance the code: > > > > StringBuffer sb = new StringBuffer(); > > KeyRange range = ds.allocateIds("a", 2); > > for (Key key : range) { > > sb.append("\n a " + key.toString()); > > } > > > > range = ds.allocateIds("b", 2); > > for (Key key : range) { > > sb.append("\n b " + key.toString()); > > } > > > > Key parentKey = KeyFactory.createKey("c", 1); > > sb.append("\n c " + parentKey.toString()); > > > > range = ds.allocateIds(parentKey, "d", 2); > > for (Key key : range) { > > sb.append("\n d " + key.toString()); > > } > > System.out.println(sb.toString()); > > > > Local produce: > > a a(1) > > a a(2) > > b b(3) > > b b(4) > > c c(1) > > d c(1)/d(5) > > d c(1)/d(6) > > > > But in production environment: > > > > a a(1) > > a a(2) > > b b(1001) > > b b(1002) > > c c(1) > > d c(1)/d(1) > > d c(1)/d(2) > > > > a a(1003) > > a a(1004) > > b b(3) > > b b(4) > > c c(1) > > d c(1)/d(1001) > > d c(1)/d(1002) > > > > Thanks > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---