Reputation: 498
I am trying to create a query in Objectify with "OR" clause, but i dont found in any place how to do it. Even reading the user's guide of Objectify v5, i don't found anything. I found only this here, but it not apply to me.
In sql the clause would be like this:
SELECT * FROM bulletin WHERE visibility = 'public' OR ownerId = :userId
Upvotes: 0
Views: 651
Reputation: 13556
You can use the low-level API Query.CompositeFilter
object directly, which supports some level of AND and OR composition:
com.google.appengine.api.datastore.Query.Filter filter = // see docs
ofy().load().type(Thing.class).filter(filter);
Here are some examples of how to make a composite filter:
Upvotes: 3
Reputation: 35961
The problem that Google Datastore doesn't support OR
filters at all (only multiply values of same field, IN
).
But you can make two separate queries and join results into one.
Upvotes: 2