No, it is not an academic debate : FK are modeled by reference, so it is not necessary to add a field to model a FK (redundancy). PK are necessary : put id in the base class, it's all.
I found a simple way to avoid to add FK in 1-1 association with OJB. Houari -----Message d'origine----- De : Gelhar, Wallace J. [mailto:[EMAIL PROTECTED]] Envoy� : mercredi 19 f�vrier 2003 16:41 � : OJB Users List Objet : RE: dirty 1-1 association I find it ironic that the list gets complaints about having to place foreign keys into the persistent objects, but they seem to not care about having to put the primary key in to the object. If you want to be a purist, any database concept should stay out of the persisted object so the method of persistence can be changed (i.e. database persistence to xml persistence). You should have a map in the persistence layer to resolve PK and FK identifiers from the objects themselves. However, that being said and done, lets leave academia behind and focus on what is practical to implement in the real world. As Thomas has pointed out, making OJB 100% transparent persistence would make the implementation at least an order of magnitude more difficult. If you want to make your objects as flexible as possible, you are going to implement an interface anyways, not exposing the actual object to your business layer. So who cares what is present in the underlying object? You can "hide" the PK and FK in the implementation of the object. After all, most of us will not be leaving RDBMS behind anytime soon. Just food for thought. Wally -----Original Message----- From: TINE Houari (OBJECTIVA) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:01 AM To: [EMAIL PROTECTED] Subject: dirty 1-1 association Hi, In the thesis "Javal baseeruv objektide p�sivuse kiht Jakamar" p. 17, there is a good sentence: "Adding persistence into the classes themselves is not always possible - they might be third party components." But OJB violates this principles by forces introducing a link modeling foreign key for 1-1 association and inheritence. For 1-1 association from A to B, it is necessary to add a reference (calss B) in class A to model the association: OK. But adding an integer (for example) to model a database foreig in the class A is a very very bad thing. There is any way to avoid that monstrosity. Houari TINE --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
