one*_*jig 6 java google-app-engine jpa jdo google-cloud-datastore
放置在数据存储区中的对象将具有一组标记.
public class Model
{
List<String> tagList
...
}
Run Code Online (Sandbox Code Playgroud)
在Python中,Google App Engine具有列表属性的概念.Java中的等效概念(如果存在)以及如何在Java,JPA和/或JDO中使用列表属性?
top*_*hef 10
请参阅我的博客文章:关键字索引实体的高效关键字搜索和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();
Run Code Online (Sandbox Code Playgroud)
其中DocumentKeywords包含Document其实体的所有关键字的列表属性(集合),而Document实体是其父项DocumentKeywords.
| 归档时间: |
|
| 查看次数: |
4582 次 |
| 最近记录: |