I am trying to write a google app engine JDO query for selecting all users who's name starts with "a". I saw a method for doing this called startsWith()
in data nucleus documentation. But it is not working in google app engine. Is there any work around for this problem?
The solution for getting a string starting with 'a' is as follows..
PersistenceManager pm = dataStoreService.getPersistenceManager();
Query query = pm.newQuery(User.class);
query.setFilter("name>= :a && name < :b");
return (List<UserInfo>) pm.detachCopyAll((List<UserInfo>) query.execute(a,a + "\ufffd"));
The "\ufffd" means largest possible unicode string.