Re: Updating EOObjects/Selecting EOObjects
Re: Updating EOObjects/Selecting EOObjects
- Subject: Re: Updating EOObjects/Selecting EOObjects
- From: Arturo Perez <email@hidden>
- Date: Tue, 23 Aug 2005 09:50:50 -0400
Ken Anderson wrote:
It's also important to realize that you can construct qualifiers with
relationships without having to go down into the attributes (which you
shouldn't even be able to do because the relationship attributes should
not be class properties!). For instance, if you wanted to find all the
classes that a particular teacher teaches, assuming you have teacher
objects and schoolClass objects, and your schoolClass EO has a
relationship called 'teacher':
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat
("teacher = %@", new NSArray(teacherObj));
EOF knows that 'teacher' is a relationship on schoolClass, so it will
use the related properties and generate a query something like this:
select class_name, blah, blah from school_class t0 where t0.teacher_id
= 42
Ken
That's one of my favorite EOF features. To expand your example a bit
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat
("course.section.teacher= %@", new NSArray(teacherObj));
if applied to a Course kind of thing will find all the courses taught by
that teacher. My SQL join foo is weak so I really appreciate the above :-)
-arturo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden