Primary/Foreign keys and accessors
Primary/Foreign keys and accessors
- Subject: Primary/Foreign keys and accessors
- From: Serge Cohen <email@hidden>
- Date: Tue, 10 Jul 2007 13:30:59 +0200
Hello list;
I have the following model, made of 3 entities (A, B, C, plus some
other entities which link to C).
A and B have PK A_id and B_id (plus other fields, irrelevant to the
question). They are both linked to C by a to-many relationship (the
reverse is a to-one relationship) :
C contains foreign keys for linking to A and B, it has its own key
(C_id) because I need to link other entities to C.
In short (if the attachment goes through) here is what I (would like
to) have :
The problem I have is that when I'm given a A and a B, I'd like to be
able to retrieve the C(s) corresponding to this pair.
To do that I have a fetch (on C) with representation string :
((FK_A_id = $someA.A_id) and (FK_B_id = $someB.B_id))
When I have all this set this way, the fetch is throwing an exception :
Error:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
valueForKey(): lookup of unknown key: 'A_id'. This class does not
have an instance variable of the name A_id or _ A_id, nor a method of
the name A_id, _A_id, getA_id, or _getA_id
Reason:
<A 0x267610> valueForKey(): lookup of unknown key: 'A_id'. This class
does not have an instance variable of the nameA_id or _ A_id, nor a
method of the name A_id, _A_id, getA_id, or _getA_id
Indeed the only solution I've found so far to avoid this type of
exception is to give accessors to all the primary keys/foreign keys
involved in the fetch.
Now, none of the these keys are compound keys, so I'd rather avoid
having accessors to them, so I am wondering if there is a solution to
get the same functionality but without giving accessor to the keys.
Thanks in advance.
Serge.
Attachment:
PGP.sig
Description: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
_______________________________________________
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