• 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: Serge Cohen <email@hidden>
  • Date: Tue, 10 Jul 2007 18:36:55 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again;

I've just realised how I should do what I'm looking for :

The fetch should be :

((a = $someA) and (b = $someB))

instead of going through the keys as in

((FK_A_id = $someA.A_id) and (FK_B_id = $someB.B_id))


Indeed I guess I'm just too much used to SQL, and tend to forget the beauty of EOF...


Serge.

Le 10 juil. 07 à 13:30, Serge Cohen a écrit :

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 :

<pastedGraphic.png>


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:
40users.sourceforge.net


This email sent to email@hidden

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin)

iD8DBQFGk7Ws5EPeG5y7WPsRAgxEAJ9hoq8N83KsX9k8TdEvGzd039MmbwCgpvzG
VZoBgNfP04IX+4wfv7Hm2T8=
=vZL5
-----END PGP SIGNATURE-----
_______________________________________________
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: Re: ERXGenericRecord willUpdate()
  • Next by Date: Re: WOLips Ant Build
  • Previous by thread: Re: Primary/Foreign keys and accessors
  • Next by thread: ERXGenericRecord willUpdate()
  • Index(es):
    • Date
    • Thread