I play with the Google engine and worry a bit about JDOQL queries .
This example shows how to retrieve data from a data store:
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 receive material only for this user?
The bottom of the page in the link above shows that we could be something like:
select from guestbook.Greeting where author == ' alfred@example.com '
But if I try the following, it will not get 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 retrieved, as shown in the same example, like this:
UserService userService = UserServiceFactory.getUserService(); User user = userService.getCurrentUser();
I'm sure this is a common task, but I just can't get it to work - any help is appreciated!
source share