• 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: Updating primary key value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Updating primary key value


  • Subject: Re: Updating primary key value
  • From: Ray Ackland <email@hidden>
  • Date: Tue, 28 Sep 2004 11:01:57 +1200

Ben,

I know what all the long-time WO users (not mentioning general DB users) will be thinking - "the pk's are for the database to use, not the users". I believe everyone would advise *strongly* not to have the pk's modified by the users. It makes things hard enough just having a meaning attached to them.

However, having said all that, if you really have "no option" about this (and there is always an option, even if not desired) then I would expect that each time a user wanted to change a value that was linked to a pk, you would need to change the pk in question (most probably by creating a new record to replace your old one as you mentioned) but also need to go through all linked tables and change the foreign keys to match the new value as well.

Would it not be possible to add another attribute/field which simple duplicates the existing pks, but splits the role of the current ones into true pk's the db can use, and nominal numbers the users can use?

r

On 28/09/2004, at 3:12, Benjamin Adair wrote:

Morning all.

I, understandably, am getting errors attempting to update the primary key of an EO. This is a situation where the PK is a meaningful attribute, yet must be user modifiable. (I am fitting a WO app to an existing system that drives our web site. Changing it to work with WO is not possible -nor should it be required in my idealist's world. Ah, the life of the idealist..)

What have others done to work around this? Turning off the PK attribute in the EOModel gives errors were EOAccess expects the entity to have a PK. The only solution that comes to mind is to watch for when the user has modified the PK and manually insert what is essentially a brand new row and delete the old. Is there a simpler solution? If it's there in the API, I'd appreciate a quick pointer where to look, though I didn't see anything obvious from what I've seen so far.

Thanks!
Ben

_______________________________________________ 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
References: 
 >Updating primary key value (From: Benjamin Adair <email@hidden>)

  • Prev by Date: 10.3 deployment and permissions
  • Next by Date: Editing context not reflecting edits?
  • Previous by thread: Updating primary key value
  • Next by thread: Editing context not reflecting edits?
  • Index(es):
    • Date
    • Thread