Hi,

I'm creating records of a user's actions. When I fetch these records,
I only ever want them sorted in reverse chronological ordering (the
order they were inserted into the datastore). Does app engine by
default return records in this order? I'm trying to avoid having to
keep an extra index on timestamp to reduce the number of indexes I
use. Example (in java):

    class Action {
        @PrimaryKey
        @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
        private String usernameOwner;

        @Persistent
        long timestamp;
    }

    public void userActionPerformed(PersistenceManager pm) {
        pm.makePersistent(new Foo("myusername",
System.currentTimeMillis());
    }

    public void getRecords(String username) {
        String stmt = "SELECT FROM " + Action.class.getName() + "
WHERE usernameOwner = '" + username + "'";
        Query q = pm.newQuery(stmt);
        q.setOrdering("timestamp desc"); // want to avoid this.

        return (List<VRec>)q.execute();
    }

    // desired html: //
    You performed a foo action on July 21 at 4:22pm!
    You performed a boo action on July 21 at 3:21pm!
    You performed a goo action on July 19 at 9:42pm!
    ...

so, it would be great if I don't have to index on the timestamp - just
get the records back in the order I inserted them - possible?

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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to