I am using google app engine to save comments on my website. I would want to sort these by a particular column. I save the time a comment is posted in this column. So the datastore looks like this
id message time
name=seth good luck Jul 30, 2014 2:04:06 PM
name=henry good luck Jul 30, 2014 7:03:31 PM
Query q = new Query("comment").addSort("time", SortDirection.DESCENDING);
PreparedQuery pq = datastore.prepare(q);
Most likely, you did not make "time" an indexed property. From the documentation:
A query can't find property values that aren't indexed, nor can it sort on such properties. See the Datastore Indexes page for a detailed discussion of unindexed properties.
You store it as a String. It will sort it as a String, not by time. You should store it as a Long value - it will save you a lot of space and the sorting will be correct.