How to use list properties in Google App Engine data store in Java?
•
Java
Objects placed in the data store will have a set of tags
public class Model { List<String> tagList ... }
In Python, Google App Engine has the concept of list attribute Equivalent concepts in Java (if any) and how to use list attributes in Java, JPA and / or JDO?
Solution
Please refer to my blog post: efficient keyword search with relation index entities and objectify for Google datastore It discusses the use of relational index entities and objectify to search list attributes
To sum up:
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 the list attribute (Collection) of all keywords of its document entity, and the document entity is the parent of documentkeywords
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码