unable to search within List of Strings - Objectify 3.1

Jagdish

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"

pipng13579

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related