android - Realm query for all entities that have a field with a certain value -
sorry if title vague, didn't know how else describe it.
i making android application in users can browse list of events @ festival, click on them more detailed overview of event , it's performance times.
here's java model:
public class festivalentity extends realmobject { @primarykey public string code; public string description; public string title; public int minimumage; public string squareimage; public string landscapeimage; public realmlist<performanceentity> performances; public date firstperformance; } public class performanceentity extends realmobject { public date start; public date end; public double price; public boolean favorite; }
my question is: how make query finds festivalentity
s have performanceentity
favorite
? can't select individual performanceentity
because there no primary key performanceentity
table.
what looking similar (invalid) query:
//should return list of festivalentity's contain @ least 1 performance favorite realmresults<festivalentity> results = realm.where(festivalentity.class).any("performances.favorite", true).findall();
actually, think use-case following query :
realmresults<festivalentity> results = realm.where(festivalentity.class) .equalto("performances.favorite", true) .findall();
please check if i'm right though, link queries confuse me.
Comments
Post a Comment