I am playing with google app engine and having a bit of trouble on JDOQL queries.
The example shows how to fetch stuff from the datastore:
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + Greeting.class.getName();
List<Greeting> greetings = (List<Greeting>) pm.newQuery(query).execute();
But what if I want to fetch stuff only for a given user?
At the bottom of the page in the link above it shows we could something like:
select from guestbook.Greeting where author == '[email protected]'
But if I try the following it doesn't fetch anything:
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + Greeting.class.getName() + " where author == '" + user.GetEmail() + "'";
List<Greeting> greetings = (List<Greeting>) pm.newQuery(query).execute();
where user
is fetched as shown in the same example like this:
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
i am sure this is a common task but I just can't get it to work - any help appreciated!