在我的Google应用应用中,我有public String[] UserRoles;
字段的实体。如何获取此列表中包含特定字符串的记录?
我的意思是,我想写一些类似
的内容ofy().load().type(ExampleEntity.class).filter("UserRoles contains", "foo").list()
有可能吗?
答案 0 :(得分:1)
数据存储区中的过滤对集合属性具有特殊含义:
ofy().load().type(ExampleEntity.class).filter("UserRoles", "foo")
这意味着在UserRoles集合中加载具有“foo”值的记录(请注意,在Java中,字段以大写字母开头是不好的形式)。
确保@Index字段,您的查询应该有效。