【问题标题】:Execute IN query in DataStore Google App Engine在 DataStore Google App Engine 中执行 IN 查询
【发布时间】:2014-03-26 07:03:28
【问题描述】:

我想执行query 来检查应用引擎DataStore 上IN 标准的数据。是否可以在 Datastore 中对 IN 条件执行查询?我为此使用下面的代码,但我不确定它是否有效。如果不可能,那么请提出任何解决方案,因为我想根据标准列表检查我的数据。

代码:

        EntityManager mgr = null;
        Cursor cursor = null;
        List<UserFeedMaster> execute = null;

        try {
            mgr = getEntityManager();
            Query query = mgr
                    .createQuery("select f from UserFeedMaster f where f.userName=:userName_fk1 and f.feedBlobKey in (id1,id2,id3)");
            query.setParameter("userName_fk", id);
       } finally {
            mgr.close();
       }

        return CollectionResponse.<UserFeedMaster> builder().setItems(execute)
                .setNextPageToken(cursorString).build();

【问题讨论】:

    标签: java android google-app-engine jpa google-cloud-datastore


    【解决方案1】:

    App Engine 支持 IN 查询。以下文章解释了如何使用它们:

    http://gae-java-persistence.blogspot.com/2009/12/queries-with-and-in-filters.html

    请注意,IN 查询存在限制。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-07
      • 1970-01-01
      • 2014-03-02
      • 1970-01-01
      相关资源
      最近更新 更多