You should still be able to do the following:

mysite.com/rest?key=someencodedkey

The advantage of doing this is that you don't have to expose the
internal structure of your entity groups, and that you will be able to
fetch your object like so:

        Team team = pm.getObjectById(Team.class, "someencodedkey");

You can change a Key into a String by doing the following:

        String keyString = KeyFactory.keyToString(Team.getKey());

getObjectById will figure out how to construct a key based on the
Team's entity parent and do the query for you. This is documented
here: 
http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html

Ikai

On Nov 5, 6:50 am, "[email protected]" <[email protected]> wrote:
> Is there any way to look up a owned child object using the numeric
> 'id' being stored on the Key object?  I have a owned child object
> called Team that I would like to be able to look up with a numeric ID
> besides the Key object.  The reason for this is I am implementing a
> service that would take a URL like the following:
>
> mysite.com/rest?id=1234
>
> I would use the id to look up a unique Team.  The problem is since the
> Team object is a child of a User object I am forced to use the Key
> object as a Primary Key.  I don't want to put some long string like
> "User(567)/Team(1234)" in my URL in order to look up the object,
> instead I would like to store just the teams numeric ID and then look
> up the object with that.  I see in the datastore that every Team has a
> unique numeric ID so I would assume there is some way to look up the
> object using that.  I also see that each Key object has access to that
> ID (Key.getId()).
>
> I tried a few different queries and had no luck.  First of all is this
> possible?  If it is can someone show me an example of what that query
> would look like?
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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