[英]GAE Datastore Get query not returning anything
I have saved some data in the GAE datastore using Android Studio backend and I am able to see that in the datastore console. 我已经使用Android Studio后端在GAE数据存储区中保存了一些数据,并且可以在数据存储区控制台中看到这些数据。 However, when I try to retrieve the data from the same backend in my app using queries, it is not returning anything at all. 但是,当我尝试使用查询从应用程序中的同一后端检索数据时,它根本不返回任何内容。 Also it is not throwing any error as well. 而且它也不会引发任何错误。 Here is the code snippet which is supposed to retrieve the entities of kind "Match": 以下是应该检索“匹配”类型的实体的代码段:
Date date=new Date();
Filter filter=new FilterPredicate("matchTime", FilterOperator.GREATER_THAN,date);
Query qry=new Query("Match").setFilter(filter);
PreparedQuery pq=datastoreService.prepare(qry);
List<Entity> entities=pq.asList(FetchOptions.Builder.withLimit(5));
Here is what I have already tried: 这是我已经尝试过的:
In all cases I got just an empty List without any error. 在所有情况下,我只得到一个空列表,没有任何错误。 Please suggest what I am doing wrong here. 请在这里建议我做错了什么。 The put operations I performed at different times worked just fine so must be something with the the query. 我在不同时间执行的put操作工作得很好,因此查询中必须有一些操作。
There is nothing wrong with your code. 您的代码没有错。
Check that you use the correct entity kind ("Match" in your code). 检查您使用的是正确的实体类型(代码中的“匹配”)。 I use static constants for kinds and property names. 我将静态常量用于种类和属性名称。 Many developers use class names for kinds. 许多开发人员将类名用于种类。 In both cases the idea is to prevent typos, when providing a kind - or property name - to the query. 在这两种情况下,其目的都是在为查询提供种类(或属性名称)时防止输入错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.