• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems using primary key as attribute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems using primary key as attribute


  • Subject: Re: Problems using primary key as attribute
  • From: Ricardo Strausz <email@hidden>
  • Date: Mon, 18 Aug 2003 12:59:10 -0500

Hola Ray!
did you try simply letting the PK alone... I mean, just do not set it your self (nor implement any delegate method)??


If the PK atribute (marked as class property or not) is not assigned, the framework will try to supply one. Also be sure to have an entry in EO_PK_TABLE for that entity (if you are not using Oracle).

Or, if you realy want to assigne your self a PK to that entity (I do it just for composed PKs) implement the EODatabaseContext delegate method

public NSDictionary databaseContextNewPrimaryKey(dbContext, eo, entity);

Suerte!
Dino

On sabado, agos 16, 2003, at 01:15 America/Mexico_City, 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.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Problems using primary key as attribute
      • From: Ricardo Strausz <email@hidden>
References: 
 >Problems using primary key as attribute (From: Ray Ackland <email@hidden>)

  • Prev by Date: Re: Detecting crash and autorestart
  • Next by Date: Re: Mapping multiple EOs to one table
  • Previous by thread: Re: Problems using primary key as attribute
  • Next by thread: Re: Problems using primary key as attribute
  • Index(es):
    • Date
    • Thread