[英]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.