2
通過Objectify可以查詢對象的子對象。一個對象也可以有一個空的父對象。列出空父母的子女?
Parent parent;
List<Children> children = ofy().query(Children.class).ancestor(parent).list();
我想知道的是,如果我可以查詢空的父親?所以我想知道所有有空父母的孩子。如果我在上面傳遞null,我會得到一個異常。
也通過屬性創建查詢與一個null propValue不會返回任何內容。
Query<T> q = ofy().query(clazz);
q.filter(propName, propValue);
return q.list();
真棒!謝謝! –
等..我錯過了這裏有什麼現在filterKey? –
由於您使用的是ofy(),我認爲您使用的是Objectify4,它具有filterKey()。 – stickfigure