• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Primary/Foreign keys and accessors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Primary/Foreign keys and accessors


  • Subject: Re: Primary/Foreign keys and accessors
  • From: Stefan Klein <email@hidden>
  • Date: Tue, 10 Jul 2007 13:51:59 +0200

Hi,

your primary and foreign keys are not class properies, so you have no access to them.
You had to use a EOQualifier like:

EOAndQualifier q = new EOAndQualifier(new NSArray(new Object[] {
        new EOKeyValueQualifier("a",EOQualifier.QualifierOperatorEqual,someA),
        new EOKeyValueQualifier("b",EOQualifier.QualifierOperatorEqual,someB)
}));

EOF will generate the correct SQL's for you.

Stefan



Serge Cohen schrieb:
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.


_______________________________________________ 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
 _______________________________________________
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

References: 
 >Primary/Foreign keys and accessors (From: Serge Cohen <email@hidden>)

  • Prev by Date: Primary/Foreign keys and accessors
  • Next by Date: ERXGenericRecord willUpdate()
  • Previous by thread: Primary/Foreign keys and accessors
  • Next by thread: Re: Primary/Foreign keys and accessors
  • Index(es):
    • Date
    • Thread