Read up on this:

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.html

<http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.html>Here's
some code that should work (warning, I have not tested it, I am doing this
from memory):

String username = "someUsername";
Key key = KeyFactory.stringToKey(username);
PersistenceManager pm  = PMF.get().getPersistenceManager();
User user = (User) pm.getObjectById(key);
// Do something with user


On Mon, Feb 15, 2010 at 6:32 AM, Esteban Masoero
<[email protected]>wrote:

> Sorry to bother with this again, but I think this feature should work
> without problems. Hasn't anybody tried to to something alike?
>
> El 11/02/2010 16:03, Esteban Masoero escribió:
>
>  Hi there, I have something like:
>>
>> public class User {
>>   @PrimaryKey
>>    @Persistent
>>    private String username;
>>    ....
>>
>> But I couln't find a way of making work a query like "select * from User
>> where username = 'someUserName'" from the admin console. It's driving me
>> nuts!, Anyone has any idea how to do this? I guess it's supossed to be
>> achieved with the KEY(..) feature, but I tried different ways and couldn't
>> get it to work.
>>
>> Thanks,
>>
>> Esteban
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to