• 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: getting the PK of inserting record?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting the PK of inserting record?


  • Subject: Re: getting the PK of inserting record?
  • From: Ray Ackland <email@hidden>
  • Date: Wed, 30 Jun 2004 09:13:40 +1200

KB,

As far as I am aware, the PK of an object isn't created until the object is actually saved to the database. Up until then, it has a temporary global id - which I don't believe relates to its destined PK at all.

You do have an option of creating the PKs yourself, but you would have to check the documentation for more information on that. I'd expect that to be thread safe you could only create the PK at the last moment before saving the object yourself, otherwise (assuming you base the next PK on the last one) the PK you intended to use could be snapped up by another process.

r.

On 30/06/2004, at 1:22, Goh Keng Boon wrote:

I have an itemcode field in my table whose content is based on the PK of that particular record, for example,
record 1 of PK 1, itemcode = ITEM0001 and so on. Is there any thread safe way for me to sort of "predict" the
PK that i'm going to have once this record is saved successfully?
_______________________________________________
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.


References: 
 >getting the PK of inserting record? (From: Goh Keng Boon <email@hidden>)

  • Prev by Date: Re: Date calculation, NSTimestamp, and PostgreSQL
  • Next by Date: Re: Any WWDC News
  • Previous by thread: getting the PK of inserting record?
  • Next by thread: For documentation purposes
  • Index(es):
    • Date
    • Thread