-
1. Re: CMR question
dsundstrom Jul 15, 2002 4:10 PM (in response to tinnes)It looks like you have the key-fields in the wrong role.
-
2. Re: CMR question
tinnes Jul 15, 2002 10:36 PM (in response to tinnes)Thanks Dain,
I am using JBuilder 6 with the JBuilder Open Tool. If the XML is in-deed incorrect then the OpenTool is generating it incorrectly. I have tried manually moving things to different roles and it still doesn't work. Is there examples of 1 to many and 1 to 1 mappings that I can look at to see how to correctly configure my XML. Is there another tool like XDoclet that people use to generate the XML for them? If so are there examples of how to configure it to use with these types of relationships?
Tom
Tom -
3. Re: CMR question
dsundstrom Jul 16, 2002 1:30 AM (in response to tinnes)I don't use these types of tools, but most people use XDoclet. There is an example of each CMR type in the JBossCMP documentation available from FlashLine ($10). There will example of 1:n and n:n relationship mappings in the final quick start guide, which should be coming out within a week.
-
4. Re: CMR question
garymarsh Dec 10, 2002 7:38 PM (in response to tinnes)Hi tinnes;
Did you ever get this thing figured out? I am using JBuilder6 and I'm having the same problem with my 1-to-1 relationship CMR. My posted thread is at
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ Marsh -
5. Re: CMR question
noel.rocher Dec 12, 2002 7:37 AM (in response to tinnes)Hi guys !
I had this problem. It 's that you must understand the way to think when you describe your relations.
Here is something that will help you :
=================================================
<!-- Company-Division -->
<ejb-relation>
<ejb-relation-name>Company-Division</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>Company-is-in-Division</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Division-has-Companies</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>id</field-name>
<column-name>division_id</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
================================================
You describe the field name of the EJB from the ONE side of the relation that correspond to the column foreign key of the table in the MANY side of the relation.
Hope this help. ;o)
Noel -
6. Re: CMR question
rpa_rio Jun 15, 2005 8:38 AM (in response to tinnes)"noel.rocher@jboss.com" wrote:
Hi guys !
I had this problem. It 's that you must understand the way to think when you describe your relations.
Here is something that will help you :
=================================================
<!-- Company-Division -->
<ejb-relation>
<ejb-relation-name>Company-Division</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>Company-is-in-Division</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Division-has-Companies</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>id</field-name>
<column-name>division_id</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
================================================
You describe the field name of the EJB from the ONE side of the relation that correspond to the column foreign key of the table in the MANY side of the relation.
Hope this help. ;o)
Noel
This is not working for me because i have a composite primary key in both sides.