使用过滤器对象化投影查询
Objectify Projection Query with Filters
鉴于 class
@Entity
public class Goat{
Long pen;
Long car;
Boolean active;
…
}
我需要创建一个 returns 列表 Long
的投影查询。我应该如何编辑以下内容才能正常工作?
List<Long> cars = ofy().load().type(Goat.class).filter("pen", pen).filter("active", true).project("car").list();
您需要为您计划 query/filter 的所有字段编制索引。
例如
@Index
Long pen;
@Index
Long car;
鉴于 class
@Entity
public class Goat{
Long pen;
Long car;
Boolean active;
…
}
我需要创建一个 returns 列表 Long
的投影查询。我应该如何编辑以下内容才能正常工作?
List<Long> cars = ofy().load().type(Goat.class).filter("pen", pen).filter("active", true).project("car").list();
您需要为您计划 query/filter 的所有字段编制索引。 例如
@Index
Long pen;
@Index
Long car;