Tag: 客观化

Google App Engine投影查询返回0结果

我正在尝试执行投影查询,以便从我的数万个实体中的每个实体中获取多个属性。 我已阅读并遵循文档 ,但我的查询未返回任何结果。 我甚至将我的投影简化为仅投影单个属性,实体的ID字段,但仍然得到0结果。 这是我的简化代码: Query q = new Query(“MyEntity”); q.addProjection(new PropertyProjection(“entityId”, Long.class)); DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); PreparedQuery pq = datastore.prepare(q); int count = pq.countEntities(FetchOptions.Builder.withLimit(1000)); log.info(“query contains ” + count + ” items.”); 当我运行此代码时, count等于0.如果我只删除第二行以使查询没有投影,则count等于1000。 我在我的应用程序中使用Objectify ,但我使用GAE低级API进行投影查询,因为我使用的是Objectify v3,它不支持投影查询。 改变我的代码以支持Objectify v4会有很多工作。 我正在投影的entityId字段在我的Objectify实体对象中看起来像这样: @Id Long entityId;

使用Objectify + google appengine进行不区分大小写的filter查询

是否有一种简单的方法可以使用Objectify + google appengine(Java)进行不区分大小写的过滤查询? 基本上这是我想要做的,除了我需要电子邮件上的filter不区分大小写。 Objectify objectifyService = ObjectifyService.begin(); objectifyService.query(AppUser.class).filter(“email”, email).get();