9

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!

davibq
  • 1,089
  • 11
  • 31
  • 1
    your "edit" pointed me in the right direction: https://code.google.com/p/objectify-appengine/wiki/Concepts#Indexes – manubot Oct 20 '13 at 12:20

1 Answers1

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

All Objectify command objects are immutable.

stickfigure
  • 13,458
  • 5
  • 34
  • 50