-1

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?

Sumodh S
  • 657
  • 1
  • 14
  • 32

1 Answers1

0

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.

Sumodh S
  • 657
  • 1
  • 14
  • 32
  • which clearly does nothing about "startsWith" and what is invoked using it, or what exception is thrown by it. Hence this question is pointless as it is. You are also misusing JDOQL in that "solution". – Neil Stockton Sep 19 '15 at 08:54
  • I agree that I am misusing it... Can you please tell me another way to do the same thing in google app engine? – Sumodh S Sep 19 '15 at 09:28