>>I don't understand why it's necessary. >>I'm afraid we put relational concept in object model. > >>Say A is compose of many B.
>And what about if C is compose of many B too and D is also compose B too. Does it mean that I need to add another extra attributes (in this case three) to B class? >Is there any workaround? So what your saying is that in your database you have several tables that have relationships to one table. This would imply that the foreign key in your B table would be unique across all primary key tables (A,C,D). So the answer to your question is no, you only need one attribute to represent your foreign key in object B. I agree that this is not exactly transparent persistence, but as Thomas has pointed out, you do not need to expose the attribute publicly to your BO clients. According to Thomas, this was a design decision made long ago to simplify matters. If you *need* transparent persistence, OJB is not going to provide this at this point. Wally >It's needed in the database to put an id of A in B table. >In object model I should have a collection of B on A, >but I shouldn't find any attribut that relfect database "stranger key" >like Aid in B class ! Java references should replace database jointure >in object world, that's why there is a collection of B in A. > >Is this problem solved with OBJ : >A is compose of many B : > >A a1 = new A(); >B b1 = new B(); >B b2 = new B(); >A a2 = new A(); >B b3 = new B(); >A1.add(b1); >A1.add(b2); >A2.add(b3); >Store(a1); >Store(a2); >A1.remove(b2); >A2.add(b2); >/* >Is it ok here without taking care of updating attribute in B that >reflect A primary key ? In fact, in b2 there is an attribute that is >the "stranger key", but it's a relational concept. */ Store(a1); >Store(a2); > >______________________________________________ >Jean-Baptiste BRIAUD Sysdeo >Software engineer www.sysdeo.com > www.eclipsetotale.com > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] Tomas Klubal :-) 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]
