views:

33

answers:

0

I have done the sample guestbook project at http://code.google.com/appengine/docs/java/gettingstarted/usingdatastore.html

in this project instead of displaying all the comments to a user I want to display only the comments posted by the current user. for that I query the datastore with where condition for user. But an error is throwing and I tried with many combinations but it is not working out. my code is as follows

<%
 PersistenceManager pm = PMF.get().getPersistenceManager();
    Query q= pm.newQuery(Greeting.class);
 //String query = "select from " + Greeting.class.getName() ;
 //List<Greeting> greetings = (List<Greeting>) pm.newQuery(query).execute();
 q.setFilter("author==authorparam");
 q.declareParameters("User authorparam");
 List<Greeting> greetings = (List<Greeting>) q.execute(user);
 if (greetings.isEmpty()) {
%>

but when I go directly to database and query the datastore with SELECT * FROM Greeting where author=User('[email protected]') ,,the query is working fine can any one help me how to query from the front end.