2011-04-25 13 views
6

データストアに配置されるオブジェクトには、一連のタグがあります。JavaのGoogle App Engineデータストアのリストプロパティはどのように使用しますか?

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

Pythonでは、Google App Engineにリストプロパティの概念があります。 Javaの同等の概念(存在する場合)とは何ですか?また、JPAおよび/またはJDOのJavaではリストプロパティをどのように使用しますか?

+0

答えがPythonを使用しないことを願っています! – onejigtwojig

+0

誰でもJPAの実装を知っていますか? – onejigtwojig

+1

JPAとJDOの他にJavaで利用可能な他のデータアクセスAPI、例えばObjectifyがあります。 – topchef

答えて

10

まさにこの上で私のブログの記事を参照してください:Efficient Keyword Search with Relation Index Entities and Objectify for Google Datastore。 Relation Index Entitiesと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の親です。

+1

あなたのブログの投稿がまさに私が探しているものです!ありがとう.. – onejigtwojig

3
JDO使用で

@Persistent 
private List<ContactInfo> contactInfoSets; 
関連する問題