在 Parse4J 中查询一个对象
Query an object in Parse4J
我想知道是否有可能得到一个对象,通过属性的属性过滤class。
更具体地说,如果我有:
Person<br>
-BasicInformation basicInformation
BasicInformation<br>
-Integer identificationNumber
我想检索所有具有 identificationNumber = 9000000
的人
我应该这样做:
ParseQuery<Person> personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereEqualTo("basicInformation.identificationNumber", 9000000);
但是不行。有什么想法吗?
您应该能够使用关系查询。然后主查询将查询与子查询结果匹配的所有 Person 对象。
我很快检查了 Parse4J 的文档,它似乎不支持这个,所以你可能需要自己实现或者直接调用 REST-API。
谢谢大家。我已经解决了。
我必须执行以下步骤。
ParseQuery basicInformationQuery = ParseQuery.getQuery(BasicInformation.class);
basicInformationQuery.whereEqualTo("identificationNumber", 9000000);
然后
ParseQuery personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereMatchesQuery("basicInformation", basicInformationQuery);
personQuery.find();
我想知道是否有可能得到一个对象,通过属性的属性过滤class。
更具体地说,如果我有:
Person<br>
-BasicInformation basicInformation
BasicInformation<br>
-Integer identificationNumber
我想检索所有具有 identificationNumber = 9000000
我应该这样做:
ParseQuery<Person> personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereEqualTo("basicInformation.identificationNumber", 9000000);
但是不行。有什么想法吗?
您应该能够使用关系查询。然后主查询将查询与子查询结果匹配的所有 Person 对象。
我很快检查了 Parse4J 的文档,它似乎不支持这个,所以你可能需要自己实现或者直接调用 REST-API。
谢谢大家。我已经解决了。
我必须执行以下步骤。
ParseQuery basicInformationQuery = ParseQuery.getQuery(BasicInformation.class);
basicInformationQuery.whereEqualTo("identificationNumber", 9000000);
然后
ParseQuery personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereMatchesQuery("basicInformation", basicInformationQuery);
personQuery.find();