I wondered what this errormessage would mean:

"Atleast one role of a foreign-key mapped relationship must have key fields"

my ejb-jar.xml deploymentdesriptor is:
         <ejb-relation-name>branche-gruppe</ejb-relation-name>

         <ejb-relationship-role >
            
<ejb-relationship-role-name>gruppeRelationshipRole</ejb-relationship-role-name>
            Many
            <relationship-role-source >
               <ejb-name>gruppe</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>branche</cmr-field-name>
            </cmr-field>
         </ejb-relationship-role>

         <ejb-relationship-role >
            
<ejb-relationship-role-name>brancheRelationshipRole</ejb-relationship-role-name>
            One
            <relationship-role-source >
               <ejb-name>branche</ejb-name>
            </relationship-role-source>
            <cmr-field >
               <cmr-field-name>gruppen</cmr-field-name>
               <cmr-field-type>java.util.Collection</cmr-field-type>
            </cmr-field>
         </ejb-relationship-role>

I have a 1:n Relationship, and I needed to add the following XDoclet to the
getBranche-Method in Gruppe, because the relatioship is
Gruppe(n) (field "branche") - Branche(1) (collection gruppen):

@jboss.relation  fk-constraint = "yes"
                        related-pk-field = "id" (id of Branche)
                        fk-column = "branche"

this added the key fields in jbosscmp-jdbc.xml:

    <ejb-relation>
      <ejb-relation-name>branche-gruppe</ejb-relation-name>

      <ejb-relationship-role>
          
<ejb-relationship-role-name>gruppeRelationshipRole</ejb-relationship-role-name>
          <fk-constraint>yes</fk-constraint>
                  <key-fields/>

      </ejb-relationship-role>
      <ejb-relationship-role>
          
<ejb-relationship-role-name>brancheRelationshipRole</ejb-relationship-role-name>
          <key-fields>
             <key-field>
               <field-name>id</field-name>    
               <column-name>branche</column-name>
             </key-field>
          </key-fields>

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



<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3827237#3827237";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3827237>Reply 
to the post</a>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to