Java App Engine DatastoreService或PersistenceManager? [英] Java App Engine DatastoreService or PersistenceManager?

查看:151
本文介绍了Java App Engine DatastoreService或PersistenceManager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用java中的GAE构建应用程序。无法确定我想要使用DatastoreServices和Entity类,还是为我的对象创建类以及使用PersistenceManager。

有人可以解释这两种服务的不同之处吗? 解决方案

如果您没有固定的理由使用其中任何一种,请查看 Objectify 。这是一个更好,更可用的存储库。

SDK中的数据存储服务是低级服务,可让您直接与Bigtable RPC进行对话。您将编写代码转换为Bigtable的数据格式和API,并调用Bigtable的RPC方法。

JDO规范及其持久性管理器是一种处理创建数据类及其存储和检索的Java标准。这是比直接数据存储服务更高的抽象级别。谷歌已经实现了JDO规范在GAE上运行,所以你可以使用它,如果你想。

Objectify是JDO的替代品,它不是企业Java标准,但使用起来更加简单和有趣。它非常接近Python API,这使得它非常简洁。

Working on a app built on GAE in java. Having trouble figuring out whether i want to use DatastoreServices and the Entity class, or make class's for my objects, and using the PersistenceManager.

Can someone explain the differences of these two services?

解决方案

If you don't have a fixed reason to use either of those, take a look at Objectify. It's a much better and more usable library for storage.

The Datastore services from the SDK are low level services that let you talk directly with Bigtable RPC. You'll be writing code that translates into Bigtable's data formats and API, and calling Bigtable's RPC methods.

The JDO specification and its persistence manager are a Java standard that deals with creating data classes and their storage and retrieval. It's one level of abstraction higher than the direct datastore services. Google has implemented the JDO spec to run on GAE, so you can use it if you want to.

Objectify is an alternative to the JDO that isn't an enterprise Java standard, but is a lot more easy and fun to use. It follows the Python API quite closely, which makes it quite nice and concise.

这篇关于Java App Engine DatastoreService或PersistenceManager?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆