如何在Java中使用Google App Engine数据存储区中的列表属性?
发布时间:2020-05-24 16:48:40 所属栏目:Java 来源:互联网
导读:放置在数据存储区中的对象将具有一组标记. public class Model { ListString tagList ...} 在Python中,Google App Engine具有列表属性的概念. Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性? 请参阅我的博客文章: Efficient Keyword
|
放置在数据存储区中的对象将具有一组标记. public class Model
{
List<String> tagList
...
}
在Python中,Google App Engine具有列表属性的概念. Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性? 解决方法请参阅我的博客文章: Efficient Keyword Search with Relation Index Entities and Objectify for Google Datastore.它讨论了使用关系索引实体和Objectify实现列表属性的搜索.总结一下: Query<DocumentKeywords> query = ofy.query(DocumentKeywords.class);
for (String keyword : keywords) {
query = query.filter("keywords",keyword);
}
Set<Key<Document>> keys = query.<Document>fetchParentKeys();
Collection<Document> documents = ofy.get(keys).values();
其中DocumentKeywords包含其Document实体的所有关键字的列表属性(集合),而Document实体是DocumentKeywords的父级. (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
