Reputation: 241
I am not sure why my following Objectify code is not working for searching within list of strings.
following is my entity class:
public class Employee
{
@Id private Long id;
.
.
private List <String> location;
.
.
getter() .. setter()
}
Objectify ofy = ObjectifyService.begin();
List<Employee> employees= (List<Employee>) ofy.query(Employee.class).filter("location IN", "newyork");
employees list is empty .. even if i have Employee records with location arraylist containing "newyork"
Upvotes: 0
Views: 468
Reputation: 180
Try:
List<Employee> employees= (List<Employee>) ofy.query(Employee.class).filter("location", "newyork");
The IN operator in filter tells the query to search for Employees within a list of locations. Since you are only searching for one location, there is no need for this operator.
Upvotes: 1