PersistenceManager 和 OfyService 有什么区别

What is the difference between PersistenceManager and OfyService

在 Google App Engine 和 Cloud Endpoints 的一些示例中,它们使用 PersistenceManager to store data, but in others they use OfyService

它们有什么区别?

PersistenceManagerJDO (Java Data Objects) 库的一部分。它是 JDO 感知应用程序组件的主要接口。

Java Data Objects (JDO) is a standard way to access persistent data in databases, using plain old Java objects (POJO) to represent persistent data. The approach separates data manipulation (done by accessing Java data members in the Java domain objects) from database manipulation (done by calling the JDO interface methods).

另一方面,ObjectifyServiceObjectify 库的一部分。它是线程本地 Objectify 实例的提供者。

Objectify is a Java data access API specifically designed for the Google Cloud Datastore.

这两个库都可用于访问 Google Cloud Datastore,但是,JDO 更通用,也可用于其他数据存储。

如您所见 hereOfyService 只是 ObjectifyService 的自定义包装器。