Re: Passing an EOGenericRecord Refrence in a Direct Action
Re: Passing an EOGenericRecord Refrence in a Direct Action
- Subject: Re: Passing an EOGenericRecord Refrence in a Direct Action
- From: Chuck Hill <email@hidden>
- Date: Mon, 19 Sep 2005 09:48:26 -0700
Me, I'd swallow my lilly white purity inclinations and just expose
the PK in this case. Or don't expose it and use EOUtilities.
primaryKeyForObject(EOEditingContext ec, EOEnterpriseObject object)
to get at it. EOUtilities also has a method to get an object based
on the PK. I don't see any reason to not use the PK in this case, it
has no meaning to the user, just a unique bit of data. You already
have one unique, meaningless bit of data, why add another?
Chuck
On Sep 19, 2005, at 8:44 AM, Daniel Eggert wrote:
On Sep 19, 2005, at 4:46 PM, Arturo Perez wrote:
Daniel Eggert wrote:
Hi,
My App displays a list of items. When the oser clicks on one, I
want to display a bookmarkable direct action with info about the
item.
How do I go about passing a reference to an item (or its
EOGenericRecord subclass instance)?
The primary key is not a class attribute, and the Apple docs say
that exposing the primary keys is a bad idea:
Primary keys and foreign keys should not be marked as class
properties. This is for two reasons: Enterprise objects have no
knowledge of the primary and foreign keys of the tables from
which they are mapped, and these keys are of no use to your
business logic. Also, to ensure that the automatic primary key
generation feature of Enterprise Objects is properly invoked,
primary keys must not be marked as class properties.
What to do?
/Daniel
You should create an alternate key (which is a technical, RDB term
BTW) to use in your direct action. Add another unique column to
your table or create a mapping table. Any number of ways to do it.
-arturo
Thanks. Is there an easy way to have either the database or
WebObjects maintain this alternate key? Or do I need to ensure the
uniqueness myself?
The mapping table is a table of unique IDs (that I maintain myself)
and a reference to my item? Or is there someting more subtle to it?
Was hoping that someone (Apple?) already coded a solution for this
trivial problem.
/Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Unnamed - an introduction to web applications using WebObjects and
Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
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