简体   繁体   English

在DataStore Google App Engine中执行IN查询

[英]Execute IN query in DataStore Google App Engine

i want to execute query which checks data for IN criteria on DataStore of app Engine. 我想执行query ,该query检查App Engine数据存储区中IN条件的数据。 Is is possible to execute query for IN criteria in Datastore? 是否可以对数据存储区中的IN条件执行查询? I am using below code for that, but i am not sure whether it will work or not. 我为此使用下面的代码,但是我不确定它是否有效。 If its not possible then please suggest any solution for that as i want to check my data against list of criteria. 如果不可能,请提出任何解决方案,因为我想对照标准清单检查我的数据。

Code: 码:

        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();

App Engine supports IN queries. App Engine支持IN查询。 The following article explains how to use them: 下面的文章解释了如何使用它们:

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

Note that there are limitations on IN queries. 请注意,IN查询有一些限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM