如何在Java中使用Google App Engine数据存储区中的列表属性?
放置在数据存储区中的对象将具有一组标记。
public class Model { List tagList ... }
在Python中,Google App Engine具有列表属性的概念。 Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性?
请参阅我的博客文章: 关键字索引实体的高效关键字搜索和Google Datastore的Objectify 。 它讨论了使用关系索引实体和Objectify实现列表属性的搜索。
总结一下:
Query query = ofy.query(DocumentKeywords.class); for (String keyword : keywords) { query = query.filter("keywords", keyword); } Set> keys = query.fetchParentKeys(); Collection documents = ofy.get(keys).values();
其中DocumentKeywords
包含其Document
实体的所有关键字的列表属性(集合),而Document
实体是Document
的父级。
在JDO中使用
@Persistent private List contactInfoSets;