• 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: using primary and foreign keys as class properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using primary and foreign keys as class properties


  • Subject: Re: using primary and foreign keys as class properties
  • From: Pierre Bernard <email@hidden>
  • Date: Sun, 4 Feb 2007 16:09:42 +0100

Hi!

You could set primary keys as class properties - provided you don't go modify their values.

I'd say the best approach - if you really, really need those values - is to set them as read-only class properties. Make sure your eogenerator template checks for read-only attributes and omits the respective setter methods.

Best,
Pierre Bernard
Houdah Software s.à r.l.


On 4 Feb 2007, at 00:36, Steven Mark McCraw wrote:

Hi everyone,

I recall reading in some of the early Apple WebObjects documentation that it's a huge terrible thing to mark your foreign and primary keys as class properties (e.g. check the little diamond in EOModeler so that your generated classes give you setters and getters to access them directly). Over the years, I've often thought it would be convenient to have the keys as class properties, particularly when I've had to write custom queries. I know EOUtilities gives you methods to get the primary and foreign keys for an object, but using these are kind of a pain compared to just calling a simple accessor method.

I've actually set keys as class properties a few times, but whenever a strange EOF exception cropped up, this was the first thing I always changed back (in a rather superstitious, paranoid way) for fear that somehow having the keys as class properties was giving EOF a fit. I started thinking about it again the other day for some reason, and frankly I can't think of any reason it should have an effect on EOF, so I thought I would pose the question to the list.

Is having keys as class properties just something that is for some reason considered "bad form" by the early documentation writers at Apple (I recall the same documentation firmly asserting that you never need to do anything outside EOF, but in the real world this isn't always practical when you need to optimize)? Or is there in fact something about having keys as class properties that throws a monkey wrench into EOF at unpredictable times?

Thanks in advance for help/discussion.

Mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden

- - - Houdah Software s. à r. l. http://www.houdah.com - Quality Mac OS X software - Premium WebObjects consulting




_______________________________________________ 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: 
 >using primary and foreign keys as class properties (From: Steven Mark McCraw <email@hidden>)

  • Prev by Date: Re: using primary and foreign keys as class properties
  • Next by Date: Re: using primary and foreign keys as class properties
  • Previous by thread: Re: using primary and foreign keys as class properties
  • Next by thread: Re: using primary and foreign keys as class properties
  • Index(es):
    • Date
    • Thread