GAE数据存储加载数据不起作用

时间:2015-07-09 19:51:13

标签: java eclipse google-app-engine google-cloud-datastore objectify

我很难从GAE数据存储区查询我的实体。这是我的实体:

My entities in datastore

这是我加载数据的代码:

    @ApiMethod(name = "getUserPost", path = "getUserPost",
            httpMethod = HttpMethod.POST)

    public Posts[] getUserPost(@Named("userEmail") String userEmail, @Named("apikey") String apikey){
       OfyService.ofy().factory().begin();

       Posts[] arr = new Posts[100];
       int ctr = 0;
      //Query<Posts> q = OfyService.ofy().load().type(Posts.class).filter("postUserEmail", userEmail);
      List<Posts> q = OfyService.ofy().load().type(Posts.class).filter("postUserEmail", userEmail).list();
      for (Posts thepost: q) {
          arr[ctr] = thepost;
          ctr++;
      }

      return arr;
    }

我不能使用Query和List来获取我的实体。 arr始终为空。

请帮帮我。

0 个答案:

没有答案
相关问题