On Mar 15, 2012, at 4:00 PM, Rich wrote:

> Hi Paul,
> 
> Thanks, I'll have a look into that - I really new to WO, and still finding my 
> feet, so was unaware of ERXGenericRecord.
> 
> 
> On 15/03/2012, at 6:22 PM, Paul Hoadley wrote:
> 
>> On 15/03/2012, at 3:25 PM, Rich wrote:
>> 
>>> Obviously NOT ideal, but unless anyone has a suggestion on a 'cleaner / 
>>> propper' way to expose it, then I think it will suffice for the 'Prototype' 
>>> - I'll change it in the 'production' version if it get's that far (honest)
>> 
>> Assuming you're extending ERXGenericRecord, won't primaryKey() or 
>> rawPrimaryKey() do what you want?
>> 

I would _highly_ recommend defining a secondary, unique, incrementing key, 
maybe call it "SyncID" and have it populated by a trigger or sequence something 
similar on commit and NOT make use of the database's PK. It's the database's 
and all you can count on is that it is UNIQUE, not that it is really in order. 
It is entirely possible for EOF to request several hundred IDs at once and 
assign them to EOs in one editing context while a second editing context comes 
along and requests some and saves _before_ the first ec does. Sure this isn't 
the _normal_ way it is done, but who knows what the next developer is going to 
do with your code and he/she probably will have an entirely different set of 
assumptions.

PKs and FKs are artifacts of the implementation of a relational database. Don't 
assign them business meaning. Create your own fields and attributes to 
represent business meaning.

Dave

—————————————————————————————
WebObjects - so easy that even Dave Avendasora can do it!™
—————————————————————————————
David Avendasora
Senior Software Abuser
Kaiten, Inc.




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to