----- Original Message ----- From: Marco Dabbene <[EMAIL PROTECTED]> Date: Tuesday, June 25, 2002 7:26 pm Subject: [Xdoclet-user] one-to-one relation problems with xdoclet and weblogic > Hi all, > > I'm using CMP 2.0 with Weblogic 6.1sp2 and the latest xdoclet > distribution from CVS and have some problems with xdoclet and > relationships. > Suppose I have two tables CUSTOMER > > CUSTOMER_ID integer (primary key) > NAME varchar(50) > ADDRESS_ID integer (foreign key to ADDRESS) > > and ADDRESS: > > ADDRESS_ID integer (primary key) > STREET varchar(50) > > Of course I have two entity beans CustomerBean and AddressBean and > I > need a one-to-one relation between them (one customer has exactly > one > address). > I assume you want a unidirectional Customer->Address relationship and not a bidirectional one, since your using the target-blabla attributes... > What I'd like are methods get/setAddress in CustomerBean to > get/set the > related Address. Follow some code from CustomerBean.java: > > /** > * @ejb:relation name="Customer-Address" > * role-name="Customer-has-one-Address" > * target-ejb="Address" > * target-role-name="Address-belongs-to-Customer" > * target-multiple="no" > * > * @weblogic:column-map foreign-key-column="ADDRESS_ID" > * key-column="ADDRESS_ID" > */ > public abstract AddressLocal getAddress(); > public abstract void setAddress(AddressLocal request); > Use @weblogic:target-column-map instead I see the docs (xdoclet/core/docs/weblogic.html) are inconsistent. (It's not true that this tag only applies to unidirectional m:n relationships as the header comment suggests). -But the "Applies To" column should give a correct description. CMR by hand is impossible for humans (different combinations of cardinality and directionality is very complicated in the various deployment descriptors). CMR with XDoclet is easier, but I think it still requires an IQ of approx. 160. Therefore I wrote Middlegen (Because I don't have an IQ of 160). CMR with Middlegen is so easy I could train my little sister to do it (she's into ceramics). Middlegen generates the source WITH correct XDoclet tags. You'll never have to worry about cardinality and directionality, as Middlegen provides a GUI that lets you modify this with point and click. -And it saves much of the time XDoclet can't save for you; Writing the @tagged source code. http://boss.bekk.no/boss/middlegen/ Make sure you use the CVS version!!! Cheers, Aslak > Now the problem: weblogic ejbc complains about a column-map > containing > an invalid key-column. I think this is explained by an extract of > the > generated weblogic-cmp-rdbms-jar.xml: > > <weblogic-rdbms-relation> > <relation-name>Customer-Address</relation-name> > <weblogic-relationship-role> > > <relationship-role-name>Address-belongs-to-Customer</relationship- > role-name> > <column-map> > <foreign-key-column>ADDRESS_ID</foreign-key-column> > <key-column>ADDRESS_ID</key-column> > </column-map> > </weblogic-relationship-role> > </weblogic-rdbms-relation> > > The <relationship-role-name> generated by xdoclet is the > target-role-name in @ejb:relation tag, but shouldn't it be role- > name > instead ? And > infact if I manually force the latter everything works ok!! > > Looking at weblogic-cmp-rdbms-jar-xml.xdt I see that > <XDtEjbRel:rightRoleName/> is always used, but maybe this time it > should > have been <XDtEjbRel:leftRoleName/>. > > I'm going really crazy abot this, so any help would by really > appreciated. > Marco > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Jabber Inc. > Don't miss the IM event of the season | Special offer for OSDN > members! > JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn > _______________________________________________ > Xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > ------------------------------------------------------- This sf.net email is sponsored by: Jabber Inc. Don't miss the IM event of the season | Special offer for OSDN members! JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
