Re: Updating EOObjects/Selecting EOObjects
Re: Updating EOObjects/Selecting EOObjects
- Subject: Re: Updating EOObjects/Selecting EOObjects
- From: Ken Anderson <email@hidden>
- Date: Tue, 23 Aug 2005 08:50:39 -0400
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
On Aug 22, 2005, at 10:57 PM, LD wrote:
Hi there,
On 23/08/2005, at 11:29 AM, Jonathan Miller wrote:
I know understand addObjectToBothSides... and removeObject ...
:-)
but what would you use to construct a qualifier over a
relationship when selecting objects?
EOQualifier will construct a qualifier based on the criteria you
specify.
e.g.,
NSMutableArray args = new NSMutableArray();
args.addObject( "firstName" );
args.addObject( someObject.name() );
args.addObject( "lastName" );
args.addObject( filteredFamily.lastName() );
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat("%
s = %@ AND %s != %@", args);
Constructs:
------------- EOAndQualifier --------------
| |
EOKeyValueQualifier EOKeyValueQualifier
with regards,
--
LD
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
_______________________________________________
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