开发者

Difference between Kind and Entity in GAE datastore?

开发者 https://www.devze.com 2023-01-02 15:25 出处:网络
What is the difference between Kind and En开发者_高级运维tity in Google App Engine datastore?An Entity is an individual record that gets stored and retrieved from the datastore.

What is the difference between Kind and En开发者_高级运维tity in Google App Engine datastore?


An Entity is an individual record that gets stored and retrieved from the datastore.

The Kind is the unique string identifier of the type of entity.

For example, "Joe" is an Entity with age=42, dob=10-12-2000, and Kind "Person".


'Kind' usually refers to simplified name of your entity class:

String kind = myEntity.getClass().getSimpleName();

But it might be whatever you set it to be. (If the persistence framework allows you to. I'd recommend Objectify BTW. :)
With Objectify you can define it like this:

@Entity(name = "MSSE")
class MySuperSmartEntity
{
}

Setting kind to something shorter than what is the class name might save you some serious space in datastore indexes.

0

精彩评论

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