0

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?

rici
  • 234,347
  • 28
  • 237
  • 341

2 Answers2

0

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.

Björn Kaiser
  • 9,882
  • 4
  • 37
  • 57
0

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();