This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes one-to-one relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "one-to-one relationship" Watch "one-to-one relationship" New topic
Author

one-to-one relationship

Jolie Lee
Ranch Hand

Joined: May 08, 2005
Posts: 87
I have a one-to-one relationship and one of the table has composite key (packageId & softwareID).
This primary key for the other table is softwareID, i declare <cmr-field-name> as softwareId and when i deploy, there's an error

org.jboss.deployment.DeploymentException: Mappings were not provided for all fields: unmaped fields=[packageId] in role=packageitems-has-software


this is my relationship in ejb_jar.xml..


<relationships>
<ejb-relation>
<ejb-relation-name>SoftwarePackage-PackageItems</ejb-relation-name>

<ejb-relationship-role>
<ejb-relationship-role-name>package-has-packageitems</ejb-relationship-role-name>

<multiplicity>One</multiplicity>

<relationship-role-source>
<ejb-name>SoftwarePackageEJB</ejb-name>
</relationship-role-source>

<cmr-field>
<cmr-field-name>softwareID</cmr-field-name>
</cmr-field>
</ejb-relationship-role>

<ejb-relationship-role>
<ejb-relationship-role-name>packageitems-belongs-to-package</ejb-relationship-role-name>

<multiplicity>Many</multiplicity>
<cascade-delete/>

<relationship-role-source>
<ejb-name>SoftwarePackageItemsEJB</ejb-name>
</relationship-role-source>

</ejb-relationship-role>
</ejb-relation>
</relationships>


and this is my relationship in jbosscmp_jdbc.xml:

<ejb-relation>
<ejb-relation-name>PackageItems-Software</ejb-relation-name>
<foreign-key-mapping/>

<ejb-relationship-role>
<ejb-relationship-role-name>packageitems-has-software</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>softwareId</field-name>
<column-name>SOFTWAREID</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>

<ejb-relationship-role>
<ejb-relationship-role-name>software-belongs-to-packageitems</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
</ejb-relation>
</relationships>


pls advise.
[ July 18, 2005: Message edited by: Jolie Lee ]

Jys<br /><a href="http://jy-s.com" target="_blank" rel="nofollow">http://jy-s.com</a><br /> <br />Trying my very best to learn java, please forgive me if i'm asking some really stupid questions.
Jolie Lee
Ranch Hand

Joined: May 08, 2005
Posts: 87
any advise pls?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one-to-one relationship
 
Similar Threads
A CMR collection may only be used within the transction in which it was created
2 primary keys??
cascade-delete doesn't work
one-to-one relationship
is there anything wrong here ?