2013-02-26 61 views

回答

0

在谷歌组评论人称为Stephen说关于db.model

IDs are 64bit positive integers. If you allocate IDs for an entity called 'Sequence' you can use them for any other entity kind, including entities with parents which would otherwise use a unique range if auto allocated. IDs from 'Sequence' will be unique within your datastore, which is a superset of the requirement that IDs be unique per-entity group. However, you must always then use an ID from Sequence and never allow auto-allocation.

他似乎知道他在说什么。我无法找到另一个对数据存储的自动ID序列发生器,但在这种类似question这里的allocateids java的定义被链接到和它说,它可以抛出这个错误:

java.lang.IllegalArgumentException - If parent is not a complete key, if num is less than 1, or if num is greater than 1 billion.

+0

嗨,保罗。感谢您的帮助。我明白它不应该返回负数或零数字。 – hogedigo 2013-02-27 00:21:39

+0

第二个引用超出了上下文 - 它并没有引用该ID,而是指定了该参数应该返回多少个ID。还要注意,生成的ID现在限制为53位,以便与js整数一起使用。 – Tom 2014-07-18 17:25:34