Ratan Kumar Ratan Kumar - 1 month ago 7
Java Question

add filter query in Google app engine

I am having problem with filtering the entities after addFilter() has been

deprecated from Google App Engine .

Objective : to list those Entities which are having UID = "rahul"

what i tried :

com.google.appengine.api.datastore.DatastoreService ds=DatastoreServiceFactory.getDatastoreService();

Query q = new Query("Upload");
q.setFilter(FilterOperator.EQUAL.of("UID","rahul"));
PreparedQuery pq = ds.prepare(q);

for (Entity result : pq.asIterable())

{
String title = (String) result.getProperty("url");
resp.getWriter().println(title);
}


And this is my DataStore Instance for "Upload" Entity :

Upload Entity Instance in Datastore

But, I am getting a blank page when launching the app .

Answer

It should give the desired output. If it is giving blank page then kindly check logs in Google Dashboard or shared logs.

Comments