Directionality of a relationship had nothing to do with the database mapping.  The default database mapping for a one-to-many relationship is to add a foreign key to the many side.
 
-dain
-----Original Message-----
From: Rama Rao [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 19, 2002 11:31 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Table Creation .. JBoss 3.0

Hi All,
 
In EJB 2.0 (CMP 2.0) if i set <create-table>true</create-table>.
How the container creates table? Based on which criteria it idenfies the columns of the table?
It is clear that all the CMP fields are treated as columns? Are CMR fields are also treated as columns?
I have  the following deployment descriptor.
 
Unidirectional relation ship from Order to OrderLine.
 
   <relationships>
     <ejb-relation>
 <ejb-relation-name>Orderr-OrderLine</ejb-relation-name>
 <ejb-relationship-role>
 <ejb-relationship-role-name>Orderr-has-OrderLine</ejb-relationship-role-name>
 <multiplicity>One</multiplicity>
 <role-source>
 <ejb-name>Orderr</ejb-name>
 </role-source>
 <relationship-role-source>
  <ejb-name>Orderr</ejb-name>
 </relationship-role-source>
 <cmr-field>
  <cmr-field-name>orderLines</cmr-field-name>
  <cmr-field-type>java.util.Collection</cmr-field-type>
 </cmr-field>
 </ejb-relationship-role>
 
 <ejb-relationship-role>
 <ejb-relationship-role-name>OrderLine-belongs-Orderr</ejb-relationship-role-name>
 <multiplicity>Many</multiplicity>
 <relationship-role-source>
  <ejb-name>OrderLine</ejb-name>
 </relationship-role-source>
 </ejb-relationship-role>
 </ejb-relation>
     </relationships>
 
The tables that are automatically created by the container has following fields
For Order
Name                                                  Null?    Type
----------------------------------------------------- -------- ----------------
ORDERID                                               NOT NULL VARCHAR2(255)
NAME                                                           VARCHAR2(255)
ADDRESS                                                        VARCHAR2(255)
This looks ok .
 
And For Order Line
Name                                                  Null?    Type
----------------------------------------------------- -------- ------------------
ORDERLINEID                                           NOT NULL VARCHAR2(255)
ORDERID                                               NOT NULL VARCHAR2(255)
PRODUCT                                                        VARCHAR2(255)
ORDERR_ORDERLINES_ORDERID                                      VARCHAR2(255)
 
where i have not specified any CMR field for OrderLine why is the 4th column created?
 
Can any body clear me what is that i am doing wrong here?
 
Thanks in Advance
Rama Rao
 
 
 

Reply via email to