Thanks!

On Apr 5, 7:34 am, Thomas <[email protected]> wrote:
> Hi Mark:
>
>     The KeyFactory.keyToString and KeyFactory.stringToKey should be
> what you want. KeyFactory.keyToString converts a Key instance to a
> plain String which can be passed to browser and then be sent back to
> server later by another user request. The server can convert it to a
> Key by calling KeyFactory.stringToKey and use the key in a query.
>
> Thomas
>
> On 4月5日, 下午10時22分, Mark <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I set up a persistent class like this:
>
> >   @PersistenceCapable
> >   public class Farm
> >   {
> >       @PrimaryKey
> >       @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >       private Key mKey;
> >   }
>
> > I might send a representation of this object down to a client browser.
> > I imagine it could be in JSON format. How can I include the mKey id so
> > that the client can interact with the Farm instance later on? I see
> > Key has a method getId() which returns a long. Is this what we can
> > send down to the client? I basically want to expose a service like
> > this:
>
> >   mysite.com/plowfarm?id=abc
>
> > so I need a way to get this particular Farm instance out of the data
> > store again from some random client, which will only know about
> > strings it reads from a JSON object:
>
> >   String qs = "SELECT FROM org.myproject.farms.server.data.Farm WHERE
> > mKey == " + id;
>
> > Is that long id the answer to this?
>
> > 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