Re: Problems using primary key as attribute
Re: Problems using primary key as attribute
- Subject: Re: Problems using primary key as attribute
- From: Ray Ackland <email@hidden>
- Date: Sun, 17 Aug 2003 18:56:58 +1200
On Friday, August 15, 2003, at 08:15 PM, Ray Ackland wrote:
The book "Using EOModeler" says "...to ensure that the automatic
primary key generation feature of Enterprise Objects is properly
invoked, primary keys must not be marked as class properties."
The "Key Generation" section of the _Enterprise Objects_ book
(http://developer.apple.com/documentation/WebObjects/
Enterprise_Objects/Saving/chapter_8_section_5.html#//apple_ref/doc/uid/
DontLinkBookID_474-DontLinkChapterID_8-TPXREF151) doesn't say that a
primary key that is a class property won't be automatically generated:
No, it doesn't, but page 50 of the other book (Using EOModeler) does.
"To take advantage of Enterprise Objects automatic primary-key
generation, an entitys primary key must satisfy these guidelines:
- It must be a simple integer; the adaptor cannot generate keys for
noninteger data types.
- It cannot be compound."
Does your primary key satisfy these guidelines?
Yes it does.
This leaves me with two ideas - server side logic to send the number
to
the client (expect it to be slow - especially when viewing a list of
clients); or don't have client # as a primary key, and create the
numbers separately.
The second option has the advantage of allowing the client # to be
updated, if necessary. This isn't possible if it is the primary key
(well, EOF isn't happy if a primary key is updated). You could invoke
a stored procedure to return the next client # prior to saving the new
object.
Wouldn't be wanting the client # to be updated. It is intended to be a
unique specifier for a client - just like a primary key.
But in any case, Giorgio's suggestion seems to have done the trick.
Ray.
_______________________________________________
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.