RushOrm
RushOrm copied to clipboard
Querying using objects getters and setters
Hello,
I want to retrieve the parent of an object given one of child fields. Is there any way to archieve this?
ex. Dog has name, human has name and list of dogs. Given a dog`s name i want to know its humans name.
Thanks!
Hi,
I think this would have to be done in two searches.
Dog dog = new RushSearch().whereEqual("name", dogName).findSingle(Dog.class);
Parent parent = new RushSearch().whereEqual("listField", dog).findSingle();
It's unlikely you would want to use findSingle i'm sure you would want to use find and check there are actually results.
Hope that helps.
Thanks