Re: using primary and foreign keys as class properties
Re: using primary and foreign keys as class properties
- Subject: Re: using primary and foreign keys as class properties
- From: Kieran Kelleher <email@hidden>
- Date: Sun, 4 Feb 2007 07:54:33 -0500
Alternatively, you could just create your own subclass of
EOGenericRecord and for all your EO's and put cover methods for the
EOUtilities methods in there. Implementing that is easy if you are
using eogenerator .... just change the extends in the generation gap
template and regenerate.
Look at Project Wonder ERXGenericRecord subclass .... if you have PW,
you can still subclass *that* class to get those key values, for
example ERXGenericRecord.primaryKey(), ERXGenericRecord.rawPrimaryKey()
(Since Art says Aloha, I have to say it in Irish :-p )
Slán, Kieran
On Feb 3, 2007, at 6:36 PM, 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:
40mac.com
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