简体   繁体   English

如何在Java中使用Google App Engine数据存储区中的列表属性?

[英]How do you use list properties in Google App Engine datastore in Java?

An object to be placed in the datastore will have a set of tags. 放置在数据存储区中的对象将具有一组标记。

public class Model 
{
    List<String> tagList
    ...
}

In Python, the Google App Engine has the notion of list properties. 在Python中,Google App Engine具有列表属性的概念。 What is the equivalent notion in Java (if it exists) and how would you use list properties in Java, in JPA and/or in JDO? Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性?

See my blog post exactly on this: Efficient Keyword Search with Relation Index Entities and Objectify for Google Datastore . 请参阅我的博客文章: 关键字索引实体的高效关键字搜索和Google Datastore的Objectify It talks about implementing search with list properties using Relation Index Entities and Objectify. 它讨论了使用关系索引实体和Objectify实现列表属性的搜索。

To summarize: 总结一下:

  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();

where DocumentKeywords contains a list property (collection) of all keywords for its Document entity, and Document entity is a parent for DocumentKeywords . 其中DocumentKeywords包含其所有关键字的列表属性(集合) Document实体和Document实体是一个父DocumentKeywords

In JDO use JDO中使用

@Persistent
private List<ContactInfo> contactInfoSets;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将本地Google App Engine Python数据存储区复制到本地Google App Engine Java数据存储区? - How do I copy local Google App Engine Python datastore to local Google App Engine Java datastore? 在Google App Engine中,如何在更新SDK后保持开发数据存储的可用性? - In Google App Engine, how do you keep your development datastore available after updating the SDK? 如何使用谷歌应用程序引擎从数据存储区检索信息,并使用Java在Android应用程序的列表视图中显示它? - how to retrieve info from datastore using google app engine and display it in a list view on an android app using java? Google App Engine,Java数据存储区查询:如何使用SQL Like语句? - Google App Engine, Java Datastore Query : How to do SQL Like Statement? 如何从Google App Engine数据存储区(Java)正确检索int? - How to correctly retrieve int from a Google App Engine datastore (Java)? 如何将数据放入Google应用引擎的数据存储区? - How do I put data into the datastore of Google's app engine? Google App Engine(Java)数据存储区检索不起作用 - Google app engine(java) datastore retrieve not working 更新Google App Engine的DataStore中的查询-Java - Update query in DataStore of google app engine - java Java Google App Engine数据存储区放置/获取 - Java Google App Engine Datastore put/get 如何使用Guice注入Google App Engine数据存储区? - How to inject Google App Engine datastore with Guice?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM