Reputation: 1
I would like to know if it is possible to get an object, filtering by an attribute of an attribute class.
To be more specific, if I have:
Person<br>
-BasicInformation basicInformation
BasicInformation<br>
-Integer identificationNumber
I want to retrieve all Person that has identificationNumber = 9000000
I should do something like this:
ParseQuery<Person> personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereEqualTo("basicInformation.identificationNumber", 9000000);
But it does not work. Any ideas?
Upvotes: 0
Views: 182
Reputation: 1
Thanks, everybody. I have resolved it.
I had to do the followings steps.
ParseQuery basicInformationQuery = ParseQuery.getQuery(BasicInformation.class);
basicInformationQuery.whereEqualTo("identificationNumber", 9000000);
And then
ParseQuery personQuery = ParseQuery.getQuery(Person.class);
personQuery.whereMatchesQuery("basicInformation", basicInformationQuery);
personQuery.find();
Upvotes: 0
Reputation: 9912
You should be able to use relational queries. The main query would then query for all Person objects that match the result of your sub-query.
I quickly checked the docs of Parse4J and it does not seem to support this so you might need to either implement that yourself or call the REST-API directly.
Upvotes: 0