I am trying to execute the below query using Objectify 5.1.8 :-
Query<Coupon> coupons = ObjectifyService.ofy().load().type(Coupon.class).filter("rewardPoints !=", "").project("code").distinct(true);
for (Coupon coupon : coupons) {
out.write(coupon.getCode());
}
It is giving me an error :
java.lang.IllegalArgumentException: Inequality filter on rewardPoints must also be a group by property when group by properties are set.
Basically, what I wish to achieve is to perform a filter and project query alongside the distinct query on an entity.
Please let me know if there is something wrong with the query.
Note: rewardPoints is Indexed.
Looks like Josh was right. I changed the query and it worked perfectly.
I don't know about Objectify but in the Google App Engine Datastore a Projection query limits the returned results to just the column(s) specified. Using
distinct
is the same as grouping and from the error message, it looks like you need to addrewardPoints
to the projection in order to use the inequality filter and distinct at the same time.