Google App Engine 支持的数据存储类型
有谁知道 GAE Datastore API 是否支持用户创建的类和/或集合(例如 ArrayList 等)?
我有以下代码行:
entity.setProperty("offlineUsers",user._network._offlineUsers);
其中属性类型是我创建的“User”类的 ArrayList 。这行代码引发了以下异常:
java.lang.IllegalArgumentException: offlineUsers: com.example.computeroom.User is not a supported property type.
因此,请阅读数据存储区指南 http://code.google.com/intl/iw/appengine/docs/java/datastore/entities.html 引起我的怀疑,您无法存储您创建的类或集合/数组 - 我只能看到支持基本类型(int、boolean 等)并且没有提及用户定义的对象或数组\集合。
1- 只是为了确定 - 数据存储是否不支持用户类别?
2- 集合/数组怎么样 - 难道真的不支持数组吗?
我应该如何存储大量用户/数据列表?
Does anyone know if GAE Datastore API supports user made classes and\or collections (e.g ArrayList etc)?
I have the following code line:
entity.setProperty("offlineUsers",user._network._offlineUsers);
Where the property type is an ArrayList of a 'User' class I created . This line of code threw the following exception :
java.lang.IllegalArgumentException: offlineUsers: com.example.computeroom.User is not a supported property type.
So reading the datastore guide http://code.google.com/intl/iw/appengine/docs/java/datastore/entities.html raises my suspicion that you cannot store classes you created , or collections/arrays - I can only see support for basic types (int,boolean etc) and no mention of user defined objects or arrays\collections.
1- Just to be sure - is it true or not that the datastore has no support for user classes?
2- What about collections/arrays - can it really be that there's no support for arrays ?
How am I supposed to store large lists of users/data ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
""实体具有命名属性,其值可以是基本类型或基本类型的集合。当然,如果序列化为字节数组,则可以存储更丰富的对象,尽管这可能会阻止这些属性的有效查询。 "
看来您只能在数据存储 api 中存储基本类型的列表。
""Entities have named properties, the values of which may be basic types or collections of basic types. Richer objects, of course, may be stored if serialized as byte arrays, although that may prevent effective querying by those properties. "
It seems you can only store lists of basic type in datastore api.
如果您使用 Objectify、JPA 或 JDO,您将能够存储您自己的自定义类型。
http://objectify-appengine.googlecode.com/
If you use Objectify, JPA or JDO, you will be able to store your own custom types.
http://objectify-appengine.googlecode.com/
你绝对可以存储列表 - 我认为任何
Collection
。您可以在存储列表后在列表中进行搜索,但存在一些意外的限制和行为。当然,您可以存储任何可以序列化为字节的用户定义的类,但您将无法对它们进行索引以搜索其成员或任何内容。
You can definitely store lists - any
Collection
I think. You can search within the lists after they're stored, but there are some unexpected limitations and behaviors.You can store any user-defined class that you can serialize into bytes, of course, but you won't be able to index them to search on their members or anything.
我不确定它是否回答了你的问题..
在阅读查询和索引页面时,我在某些地方看到了这个
i'm not sure whether it answers your question..
Some where while reading queries and indexes page i saw this