我有一个这样定义的客观化实体:为什么不按部分实体键过滤?
public class MyEntity1
{
@Id @Indexed String phoneNumber;
@Parent @Indexed Key<MyEntity2> parentEntityKey;
}
当我试图通过phoneNumber的筛选,我收到以下错误信息:
Cannot (yet) filter by @Id fields on entities which have @Parent fields.
这样做的原因建设,我想当我知道phoneNumber和parentEntityKey时,我有时可以得到(而不是查询)这些记录。在其他一些情况下,我只知道phoneNumber并希望查询它。
这是Objectify或Datastore的缺点,我可以找到解决办法吗?你有一个解决我的两个要求的提案(当我知道这两个值时通过phoneNumber查询,而不知道什么时候获得查询)?