Need to make query by one of multiple objects inside other.

Hello,
I will try to describe situation:
I have main objects list in db, every object have inside one column with a relations to another object, and can have multiple objects inside. So i need to make query to get list of main objects that have one of inner object in it that i want to specify. Can do this by unique name of inner object, like i put to query only name of inner object and get the list of all that contains it?

Thnx;)

I am trying to do right now in this way

query.whereClause = “MainObjectClassName[innerColumnName].name=’” + nameIwantToSearchBy+ “’”;

Hi Max,

If I understand correctly you want to get a list of only those main objects where the inner one satisfy a query?

For example, if the main object is Person (name, age) and Person has relationship to a collection of Address objects (street, city, state). You want to load Person objects where city = “New York” ?

Regards,
Mark

For example i have Person (name,age… and for example children, that can be multiple), also we have db table Child(name). So in this example I need to get list of all persons that have children with specific name.

P.S. children column related to multiple Child objects.

In this case your “where” clause would be something like this:

"children.name = 'John'"

where “children” is the property name in the Person class and “name” is the property in the “Child” class.

Hope this helps.

Regards,
Mark

Yes, it helps;)

My mistake was that i tried “Person[children].name = ‘John’”

Thanks a lot;)

You are welcome!