哪个 API 适用于 App Engine 和 Datastore?

Which API for App Engine and Datastore?

我正在使用 Java,我想将 Datastore 与 App Engine 结合使用。我应该使用哪个 API?

有 'com.google.cloud.datastore' 还有 'com.google.appengine.api.datastore'

更具体地说,有 'com.google.cloud.datastore.Entity' 以及 'com.google.appengine.api.datastore.Entity'。我如何决定使用哪一个?

编辑: 我正在使用 Java 8 和 App Engine 标准。我也在使用 Eclipse 和 Cloud 工具。当我使用 'Google Cloud Platform Libraries' 添加库时,会添加两者的 jar。参见:https://cloud.google.com/eclipse/docs/libraries

您提到的端点用于 API 和客户端库:

com.google.appengine.api.datastore -> API 专门设计用于部署在 AppEngine 上的应用程序。

com.google.cloud.datastore -> Client Library 可用于任何应用程序。

你可以看到它们的主要区别here。尽管如此,调用 DataStore 的方式主要取决于您的环境(即 Java8、Java7、AppEngine Standards/Flex、外部应用程序)。

同样适用于实体。一种是使用 API, the other one with the methods from the Client library.

创建实体