Re: Setting an attribute based on PK?

Ashley Aitken <[email protected]> Sun, 25 Apr 2004 22:02:42 +0800
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Hola Dino!

On 25/04/2004, at 9:44 PM, Ricardo Strausz wrote:
> The key generation is done after the prepareForSaveWithCoordinator.

I was thinking something like that was happening.

> So, no more hi-level staff will be consider, i think...

I think you're probably right.

> This should be a good example to use a EOCustomObject, instead of 
> EOGenericRecord, and "set" the value directly to the EO (instead of 
> using takeValueForKey()). I'd never done it, but it should work. 
> Please, let us know.

I'm not sure exactly what you mean here, I understand EOCustomObjects 
have "real" variables, so are you suggesting that if I set those 
variables after the primary key is generated (and after 
prepareForSaveWithCoordinator is done as you suggest above) that 
perhaps these will get saved to the database?

Either way, I think I will just go with the approach I suggested in my 
reply to me (generating the primary key on insert rather than 
saveChanges).  Can you think of any disadvantage of this?  Besides, of 
course, a roundtrip to the database which may be unnecessary if the 
changes aren't saved, and the use of a primary key in the sequence ...?

Suerte!
Ashley.

PS Excuse my ignorance, what nationality is that (and was I swearing 
;-)?

--
Ashley Aitken
Perth, Western Australia
mrhatken at mac dot com