_____________Original message ____________
Subject:        [Xdoclet-user] Weblogic relationships generate 
brokenweblogic-cmp-rdbms-jar.xml
Sender: Daniel Bratell <[EMAIL PROTECTED]>
Date:           Wed, 30 Jan 2002 16:25:50 +0100

I've been trying to describe a 1:n relationship from a customer to the 
customer's addresses with the following tags:

      * @ejb:interface-method view-type="local"
      * @ejb:relation
      *    name="addresses"
      *    role-name="one-customer-has-many-addresses"
      *    target-ejb="AddressBean"
      *    target-role-name="one-address-belongs-to-one-customer"
      *
      * @weblogic:relation
      *    target-foreign-key-column="customer_id"
      *    key-column="id"
      *


In XDoclet 1.1.1 this generates the following code 
in  weblogic-cmp-rdbms-jar.xml:

    <weblogic-rdbms-relation>
       <relation-name>addresses</relation-name>

       <weblogic-relationship-role>
          
<relationship-role-name>one-customer-has-many-addresses</relationship-role-name> 

          <column-map>
             <foreign-key-column>customer_id</foreign-key-column>
             <key-column>id</key-column>
          </column-map>
       </weblogic-relationship-role>

    </weblogic-rdbms-relation>



That is wrong because all relationships must have two 
<weblogic-relationship-role>:s. The correct xml would be:

<aslak>
No, it's not wrong. Check the DTD (it's bundled with xdoclet). Only m:n relationships 
are supposed to have two <weblogic-relationship-role>:s.

It looks as though you're trying to define a unidirectional 1:n relationship. If 
you're trying to define a bidirectional relationship, you should not specify the 
target-xxx parameters, but define the relationship in each of the two methods in the 
relation. -If you're trying to define a unidirectional one everything looks ok.

Please see the docs for @ejb:relation and @weblogic:relation for further info.
</aslak>

    <weblogic-rdbms-relation>
       <relation-name>addresses</relation-name>

       <weblogic-relationship-role>
          
<relationship-role-name>one-address-belongs-to-one-customer</relationship-role-name> 

       </weblogic-relationship-role>
       <weblogic-relationship-role>
          
<relationship-role-name>one-customer-has-many-addresses</relationship-role-name> 

          <column-map>
             <foreign-key-column>customer_id</foreign-key-column>
             <key-column>id</key-column>
          </column-map>
       </weblogic-relationship-role>

    </weblogic-rdbms-relation>




Am I doing something wrong or is this a bug?

<aslak>
At first glance it looks ok to me. Do you get an ejbc error? If you do, please post 
the error message.
</aslak>

/Daniel


_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user



_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to