开发者

Key or Long for ID in Google App Engine (JDO)

开发者 https://www.devze.com 2023-02-17 11:05 出处:网络
I\'m using JDO with Google App Engine for storage and I\'m wondering what is the difference between the Key object and Long for id?

I'm using JDO with Google App Engine for storage and I'm wondering what is the difference between the Key object and Long for id?

开发者_JAVA百科

I find the long ID more practical, am I missing anything?

Thanks.


A Key is globally uniquely identifier which uniques identifies an entity across all of app engine. It consists of two pieces:

  1. A path describing what app the entity belongs to, any ancestor keys, and the entity's kind.
  2. An ID (a long) or a key name (a string).

Regardless of whether you choose to use a long or a string as the second piece, there is a Key object is associated with every entity stored in the datastore.

0

精彩评论

暂无评论...
验证码 换一张
取 消