public List<Item> getItemsByTag(Tag tag) {
        PersistenceManager persistenceManager = getPersistenceManager(); //
my way to get PersistanceManager
        persistenceManager.setDetachAllOnCommit(true);

        Query query = persistenceManager.newQuery(Item.class);
        query.setFilter("this.tags.contains(tagKeyParam)");
        query.declareImports("import
com.google.appengine.api.datastore.Key;");
        query.declareParameters("Key tagKeyParam");

        List<Item> items = new ArrayList<Item>();

        try {
                items = (List<Item>) query.execute(tag.getKey());
                items.size();
        }
        finally {
                query.closeAll();
                persistenceManager.close();
        }

        return items;
}

On Aug 22, 9:44 am, Raghu <[email protected]> wrote:
> Hi All,
>
> I just want to reopen the existing challenge. I'm trying hard to think
> query on 2 tables with m-m relation.
>
> Tags{
> List <Key> items;}
>
> Item{
> List <Key> tags;
>
> }
>
> Please suggest me how to find all the items with given tag. is there
> any trick here.
>
> thanks
>
> raghu

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to