Re: [Modeling-users] Foreign Keys
Status: Abandoned
Brought to you by:
sbigaret
From: Yannick G. <yan...@sa...> - 2003-07-21 15:52:30
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On July 21, 2003 11:41 am, Sebastien Bigaret wrote: > > > Is there a way to do it without breaking anything ? > > > > Of course there is a way, just set the foreign key to be class property. > > > > Forgive me to post before proper re-caffeination ! > > Oh oh, here you can get into very serious troubles. Demonstration, using > test package AuthorBooks where I made Book's FK_Writer_Id a class You're just too right ! re-caffeination is so slow after those lan parties... [sniped problem demo] > What happened here? The FK is automatically set by the framework, by > examining the relationships. Since no object is related to book for > relation 'author', the FK gets overriden w/ the None value. > > That's an illustration of why PKs and FKs should be considered > *read-only* when they are made class properties, as stated in the faq > [http://modeling.sf.net/UserGuide/faq-change-class-location.html]. I might be nice to raise when trying to set a read-only property. The solution with faultForRawRow() is easier to apply anyway. - -- Yannick Gingras Byte Gardener, Savoir-faire Linux inc. (514) 276-5468 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/HAw0rhy5Fqn/MRARAtTVAKCA6OjNLjrqdaQpCCrC0l75hlaDqgCfUkvh QDgF1+ruhFYiQEYTYkgeNAI= =UGv/ -----END PGP SIGNATURE----- |