Re: Obtaining newly generated primary keys during save
Re: Obtaining newly generated primary keys during save
- Subject: Re: Obtaining newly generated primary keys during save
- From: Kieran Kelleher <email@hidden>
- Date: Fri, 19 Dec 2008 07:31:40 -0500
Wonder ERXGenericRecord.rawPrimaryKeyInTransaction()
On Dec 19, 2008, at 6:13 AM, Gennady Kushnir wrote:
Hello, list
I'm trying to get primary key value from one enterprise object to get
stored in another table.
But if the object is recently inserted it does not have any primary
key and consequently I have nothing to save.
I tried to trigger second tabe initialisation on
EOGlobalID.GlobalIDChangedNotification but it seemes too late as
changes made at that moment were not saved.
I think there should be some solution as if you save several recently
created related objects their relationship fields are properly
initialised during save with newly generated primary keys.
P.S. I do not want to use actual relationships from that table storing
pKeys as it is not in fact a part of business logic but something like
log and it stores primary keys from different tables in the same field
p.p.s. I've seen a piece of code generating primary key before actual
save on Wikibooks. I'm not shure, it is a good idea. If some (say
validation) error occures on actual save, or if save is simply
discarded afrewards, than that pregenerated key would not be emloyed
So what .... if you ever delete a record the primary key of the
generated record is not reused. If Integers go to 2+ billion max value
or whatever that is, and you don't foresee getting anywhere near 2
billion inserts, then it does not matter.
_______________________________________________
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