Re: Setting an attribute based on PK?

Strausz Ricardo <[email protected]> Thu, 29 Apr 2004 10:24:37 +0200
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
Hola Ash!

On Apr 25, 2004, at 4:02 PM, Ashley Aitken wrote:

>
> 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?

That is my conjecture!

>
> 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 
> ...?

I would follow Chuck's suggestion... he is good on that!

>
> Suerte!
> Ashley.
>
> PS Excuse my ignorance, what nationality is that (and was I swearing 
> ;-)?

Standard spanish; it means Luck!

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