Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objectify Filter by Ref

I have a m-n relationship with Objectify, and I want to get 1 side of the relation.

I was trying to solve it with this query:

        Query query = ofy().load().type(Person.class);
        query.filter("position", ceo);
        return query.list();

To return a list of CEOs. Position is a Ref< Position>.

I have tried:

query.filter("position", Ref.create(ceo));
query.filter("position", Key.create(ceo));
query.filter("position", ceo.key);

But nothing, does anyone knows how to do this?


EDIT: It was an Index problem. Sorry!

like image 726
davibq Avatar asked Mar 25 '13 18:03

davibq


1 Answers

query = query.filter("position", ceo);

All Objectify command objects are immutable.

like image 106
stickfigure Avatar answered Oct 06 '22 18:10

stickfigure