• 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: Displaying Primary Keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying Primary Keys


  • Subject: Re: Displaying Primary Keys
  • From: Ray Ackland <email@hidden>
  • Date: Sat, 27 Dec 2003 22:07:11 +1300

Drew,

public String makeSuggestion () throws probability of flame bait
{
Had the same situation as you a few months ago. Was converting a FileMaker database where each client had a file number (really a client id). This number was the in the field used to connect the database tables together. It was also the number that the owners of the database were writing on the physical folder that held all the paperwork for the client.


Now in this situation, I look at it as though the file number (client id) was meaningless in that it contained no data in itself. It was only an identifier used to locate and verify the correct client. However in this case that identifier was going to be used outside the computer system by the people running the database, and hence needed to be available for display.

The suggestion I received on how to do this (and chose to use) was to add another attribute to the EOModel (I called it client number) which mapped to the same table column as the client id. I made this attribute read only.

The result was that WO would maintain the primary key (client id - and yes, I know it is really CLIENT_ID) incrementing etc as necessary. It would also display a read-only client number which the staff could use to look up info in their files (really just a physical part of the database).

In short, and in contrast to other suggestions, I treated the client id to be a unique identifying piece of data used to distinguish separate entities - but useful in the "real" world as well. It has no meaning apart from an identifying mark, and there should never be any reason to change it (unlike a drivers licence etc).

The only problem I have struck is that this number won't be available on a newly created record until it is saved (and probably re-opened).

Regards,

ray.

return "hope this is useful";
}

On 27/12/2003, at 2:54, Drew Thoeni wrote:

public void newbieProblem() {
I read (and have found) that if I want to properly used object references between enterprise objects that I must not include the primary key in the class (i.e., I click the diamond off in EO Modeler). However, there are times I want to display the primary key. For example, in administration pages, I like to display the userID. Or when editing code tables, the primary key would be useful to display.
}


public Answer newbieQuestion() {
What is the proper way to do this? Any references out there you suggest.
}
_______________________________________________
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.

  • Prev by Date: Re: Displaying Primary Keys
  • Next by Date: Build and Run to localhost instead of domain name?
  • Previous by thread: RE: Displaying Primary Keys
  • Next by thread: xCode and EOModel
  • Index(es):
    • Date
    • Thread