Re: Problems using primary key as attribute
Re: Problems using primary key as attribute
- Subject: Re: Problems using primary key as attribute
- From: Giorgio Valoti <email@hidden>
- Date: Sat, 16 Aug 2003 09:06:22 +0200
Never tried but it should work. Use the client # as your primary key
but don't mark it as a class property and create a new read-only
attribute that maps to the primary key column.
HTH
On Sabato, ago 16, 2003, at 08:15 Europe/Rome, 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.
Does anyone have any suggestion of how to get around this. The book
also mentions: "See the API reference in the com.webobjects.eoaccess
package for EOEntity.primaryKeyAttributes and
EOEntity.primaryKeyForGlobalID, as well as the API reference for
com.webobjects.eocontrol.EOClassDescription."
Unfortunately I have had little success digging through these. I
believe the API reference instructs me to do something like the
following code snippet:
Public NSDictionary clientID()
{
EOGlobalID id = editingContext().globalIDForObject(this);
EOEntity anEntity = new EOEntity();
return anEntity.primaryKeyForGlobalID(id);
}
(more processing is due, but this is just experimental).
When compiling, I get an error message "Client.java:10: package
com.webobjects.eoaccess does not exist". I expect that is because
EOAccess is not available to the client.
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.
I am getting a sore head over all this. Anyone able to contribute an
idea?
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.
--
Giorgio Valoti
-------------
_______________________________________________
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.