I don't know the solution in python. Perhaps someone else can lend a hand
here.

The solution in Java is simple, see this as an example:
import javax.jdo.annotations.Index;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable
public class U {
    @PrimaryKey
    @Persistent
    private Long i;

    @Index(unique = "true")
    @Persistent
    private String n;

    public U(Long id, String name) {
        this.i = id;
        this.n= name;
    }

    @Override
    public String toString() { return "["+n+":"+i+"]"; }

    public Long id() { return i; }
    public String name() { return n; }
}

Then creating instances and persisting them is all that's left to do.

2010/8/25 Martynas Mickevičius <mmarty...@gmail.com>

> Could you explain more how to use longs as a keys?
>
> On 16 Lie, 19:10, Nate Bauernfeind <nate.bauernfe...@gmail.com> wrote:
> > Repeated calls will return items in a deterministic order ascending by
> key.
> > So... yes it is deterministic, though it may not be the order you want.
> >
> > Additionally, you can use Long's as your keys instead of making a counter
> if
> > you need them to return in inserted order.
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Jul 16, 2010 at 11:07 AM, Blixt <andreasbl...@gmail.com> wrote:
> > > Okay, so data will be returned in a non-determinate order unless you
> > > specify keys yourself (since ids aren't guaranteed to be in order).
> > > I'll make my own counter.
> >
> > > Thanks!
> >
> > > On Jul 16, 6:01 pm, Nate Bauernfeind <nate.bauernfe...@gmail.com>
> > > wrote:
> > > > They will be ordered by key. You should consider watching one of the
> > > > datastore tech talks.
> >
> > > > On Fri, Jul 16, 2010 at 3:54 AM, Blixt <andreasbl...@gmail.com>
> wrote:
> > > > > Imagine this query:
> >
> > > > > Person.all().fetch(100)
> >
> > > > > Is the order of data in the datastore guaranteed, or can the order
> of
> > > > > the entities returned change as data is inserted?
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Google App Engine" group.
> > > > > To post to this group, send email to
> google-appengine@googlegroups.com
> > > .
> > > > > To unsubscribe from this group, send email to
> > > > > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com><google-appengine%2Bunsubscrib
> e...@googlegroups.com><google-appengine%2Bunsubscrib
> > > e...@googlegroups.com>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-appengine?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine" group.
> > > To post to this group, send email to google-appengine@googlegroups.com
> .
> > > To unsubscribe from this group, send email to
> > > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com><google-appengine%2Bunsubscrib
> e...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to