worked around: Re: to-many keypath qualifying, weird problem
worked around: Re: to-many keypath qualifying, weird problem
- Subject: worked around: Re: to-many keypath qualifying, weird problem
- From: Jonathan Rochkind <email@hidden>
- Date: Tue, 22 Jul 2003 13:19:25 -0500
Okay, I solved this by qualifying directly on the fk/pk involved. Normally
EOQualifier's are smart enough to do this for you, I guess it's a bug, but
no big deal.
Instead of:
"grades = %@", [some Grade object]
or even the expanded keypath
"toPersonGrades.toGrade = %@", [some Grade object]
I was succesful using:
"toPersonGrades.gradeID =%@", [some Grade object's pk]
Good enough, I'm back in business. Don't know why this was neccesary when
EOQualifiers are ordinarily clever enough to do it the first two ways.
--Jonathan
At 12:43 PM 7/22/2003 -0500, Jonathan Rochkind wrote:
I'm getting some weird exceptions when I try to qualify over a to-many
keypath, which don't make any sense to me.
I have Person with a flattened to-many called "subjects" to Subject. The
expansion of the flattened to-many would be "toPersonSubjects.toSubject".
I set up a qualifier on the "subjects" relationship like:
NSArray args = new NSArray( someSubject );
iQual = EOQualifier.qualifierWithQualifierFormat(" subjects = %@
", args );
If I do a raw row fetch on just some attributes, this works. But if I do a
full search, it does not. The objectsWithFetchSpecification raises this
exception:
sqlStringForKeyValueQualifier: attempt to generate SQL for
com.webobjects.eocontrol.EOKeyValueQualifier
(toPerson.toPersonSubjects.toSubjects = (Subject)'[toString of a Subject
goes here] failed because attribute identified by key
'toPerson.toPersonSubjects.toSubjects' was not reachable from from entity
'PersonGrades'
Questions:
1) Why does it tell me the EOKeyValueQualifier keypath is
"toPerson.toPersonSubjects.toSubjects". I'd think it would just be
"toPersonSubjects.toSubjects", the expansion of my flattened relationship?
2) Wait, but the final message says "from entity PersonGrades". That's
weird, since that's a _different_ join object, involved in a different
flattened relationship. But okay, from that entity,
"toPerson.toPersonSubjects.toSubjects" _should_ be a valid keypath. So why
does it say it's not reachable? It should be reachable.
Any ideas here?
--Jonathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.