我有一個這樣定義的客觀化實體:爲什麼不按部分實體鍵過濾?
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查詢,而不知道什麼時候獲得查詢)?