【问题标题】:Objectify projection query with id as well in the result在结果中使用 id 对象化投影查询
【发布时间】:2018-04-06 11:35:39
【问题描述】:

应该如何在objectify中编写投影查询,以便实体的id也出现在结果中? (投影查询因为我的表有很多列)

我写的查询是

ofy().load().type(Item.class).filter("shopId",shopId)
    .filter("name >=",name)
    .filter("name <=",name+"\ufffd")
    .order("-creationTime")
    .project("name","imageUrl").list();

我读过将 id 放入项目函数中不起作用。有什么方法可以让我得到名称、imageUrl 和 id?

【问题讨论】:

    标签: google-cloud-datastore objectify


    【解决方案1】:

    我的错。 id 确实出现在结果中。项目函数中不需要输入id。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      • 2019-08-11
      • 1970-01-01
      • 1970-01-01
      • 2010-09-26
      • 2013-03-23
      • 1970-01-01
      相关资源
      最近更新 更多