![](/img/trans.png)
[英]How do I copy local Google App Engine Python datastore to local Google App Engine Java datastore?
[英]How do you use list properties in Google App Engine datastore in Java?
放置在数据存储区中的对象将具有一组标记。
public class Model
{
List<String> tagList
...
}
在Python中,Google App Engine具有列表属性的概念。 Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性?
请参阅我的博客文章: 关键字索引实体的高效关键字搜索和Google Datastore的Objectify 。 它讨论了使用关系索引实体和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
。
在JDO中使用
@Persistent
private List<ContactInfo> contactInfoSets;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.