sai-pullabhotla
7/21/2016 - 9:09 PM

Catatumbo - Query with a Filter using Named Parameters

Catatumbo - Query with a Filter using Named Parameters

// Select with named bindings (parameters). Note the @citizen in the query, which is a named parameter. 
EntityQueryRequest request = em.createEntityQueryRequest("SELECT * FROM people WHERE citizen = @citizen");
//Set the parameter citizen to the desired value and execute the query
request.addNamedBinding("citizen", false);
QueryResponse<Person> response = em.executeEntityQueryRequest(Person.class, request);
List<Person> persons = response.getResults();
// Process the list as needed