I have a collection of object classes with the following relations:
- Class 1 has many objects of Class 2
- Class 2 has many objects of Class 3
- Class 3 is just another data class
That is, a single Class 1 object has multiple Class 2 objects which in turn have multiple Class 3 objects.
How would I execute a query to get all objects of Class 3 that are indirectly referred to by Class 1? Can this be done efficiently? Or do I need to add a Class 1 has_one relation to class 3 (something which sounds ugly and would prefer to avoid)? This is an operation that might be done often, so it needs to be efficient.
Hans