Hi,

I created a couple of Beans with One-To-One bidirectional relationships
using xdoclet tags. After successfully generating the sources, creating
the ear and deploying, I got these messages:

******************
00:12:48,484 WARN  [ServiceController] Problem starting service
jboss.j2ee:jndiName=UserData,service=EJB
org.jboss.deployment.DeploymentException: Atleast one role of a
foreign-key mapped relationship must have key fields:
ejb-relation-name=UserHasUserData
        at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData.<init>(JDBCRelationMetaData.java:321)
        at
[...]
*******************

After hours of experimentation, I found that, if I simply removed the
relationships section of jbosscmp.xml (shown below), the problem would go
away. This happens in both xdoclet 1.1.2 and 1.2b2, btw, and also with
unidirectional One-To-One relationships.

Is this a bug? Did I forget to declare something in the build.xml or the
Beans themselves?

The offending section of jbosscmp.xml is reproduced below. It
establishes the relationship between the Beans, but this relationship is
ALREADY DECLARED (properly, AFAIK) in the ejb-jar.xml. I'm pasting it as
well, after the offending excerpt.

Thanks a lot!

Zorzella

******** OFFENDING PART from jbosscmp.xml ***********
   <relationships>
     <ejb-relation>
       <ejb-relation-name>UserHasUserData</ejb-relation-name>

       <foreign-key-mapping/>

       <ejb-relationship-role>
 
<ejb-relationship-role-name>UserHasUserData</ejb-relationship-role-name>
                  <key-fields/>

       </ejb-relationship-role>
       <ejb-relationship-role>
 
<ejb-relationship-role-name>UserDataPertainsToUser</ejb-relationship-role-name>
                  <key-fields/>

       </ejb-relationship-role>
     </ejb-relation>
   </relationships>
******** End OFFENDING PART ***********

******** Correct part, from ejb-jar.xml ********
   <relationships >
       <ejb-relation >
          <ejb-relation-name>UserHasUserData</ejb-relation-name>

          <ejb-relationship-role >
 
<ejb-relationship-role-name>UserHasUserData</ejb-relationship-role-name>
             <multiplicity>One</multiplicity>
             <relationship-role-source >
                <ejb-name>UserBean</ejb-name>
             </relationship-role-source>
             <cmr-field >
                <cmr-field-name>userData</cmr-field-name>
             </cmr-field>
          </ejb-relationship-role>

          <ejb-relationship-role >
 
<ejb-relationship-role-name>UserDataPertainsToUser</ejb-relationship-role-name>
             <multiplicity>One</multiplicity>
             <cascade-delete/>
             <relationship-role-source >
                <ejb-name>UserDataBean</ejb-name>
             </relationship-role-source>
             <cmr-field >
                <cmr-field-name>user</cmr-field-name>
             </cmr-field>
          </ejb-relationship-role>

       </ejb-relation>
    </relationships>
******** End Correct part, from ejb-jar.xml ********



-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to