Re: Problems using primary key as attribute
Re: Problems using primary key as attribute
- Subject: Re: Problems using primary key as attribute
- From: Art Isbell <email@hidden>
- Date: Sat, 16 Aug 2003 12:36:00 -1000
On Friday, August 15, 2003, at 08:15 PM, Ray Ackland wrote:
My customers have a FMP system (that I am converting to WO) where the
client # is used to match the (physical) file in their filing system.
As a result, I am wanting to use the client # as a primary key as well
as making it a class property.
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."
I have experienced this problem when creating a new record - the client
# is not automatically created.
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:
"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?
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.
Aloha,
Art
_______________________________________________
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.