문제

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"

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top