我一直在编写一个使用 GAE 的应用程序,并根据登录 Google 的用户昵称使用特定密钥存储实体。
问题是我无法进行查询来检索具有特定键的实体并对检索到的实体进行排序。
我举几个例子:
Query query = new Query("Invoice", key);
//This works; retrieved all entities that have the key
Query query = new Query("Invoice").addSort("Date", Query.SortDirection.ASCENDING);
//This works too, retrieves ALL entities sorted by the Date field.
如果我混合它们:
Query query = new Query("Invoice", key).addSort("Date", Query.SortDirection.ASCENDING):
//This doesn't work, and it is what I want;to retrieve the entities with the specific key and sorted
由一个字段(没关系正确知道)。