• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Entity CMP Mapping Questions

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All:

I am currently using Weblogic 8.1.
Currently, the ejb-jar.xml contains the following:
<ejb-relation>
<ejb-relation-name>Customer-HomeAddress</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
Customer-has-a-Address
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>homeAddress</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
Address-belongs-to-Customer
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>AddressEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>


In the weblogic-cmp-rdbms-jar.xml file:

<weblogic-rdbms-relation>
<relation-name>Customer-HomeAddress</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Customer-has-a-Address</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>ADDRESS_ID</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

In the Address table, it has an ADDRESS_ID field.
What I am confused about is where in the weblogic-cmp-rdbms-jar.xml
and ejb-jar.xml file will indicated that the Customer table has a foreign key of ADDRESS_ID field. Not the other way around of the Address table has a foreign key of "CustomerId".

The reason I am asking this is because if you look at the weblogic-cmp-rdbms-jar.xml and ejb-jar.xml below I can't tell if in the Phones table there is a foreign key to Customer or inside the Customer table there is a foreign key to Phones:

Inside the weblogic-cmp-rdbms-jar.xml file :

<weblogic-rdbms-relation>
<relation-name>Customer-Phones</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Phone-belongs-to-Customer</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>CUSTOMER_ID</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

Inside the ejb-jar.xml:
<ejb-relation>
<ejb-relation-name>Customer-Phones</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
Customer-has-many-Phone-numbers
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>CustomerEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>phoneNumbers</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
Phone-belongs-to-Customer
</ejb-relationship-role-name>
<multiplicity>many</multiplicity>
<relationship-role-source>
<ejb-name>PhoneEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>

Yours,

Curious
 
I'm still in control here. LOOK at this tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic