2 Replies Latest reply on Sep 23, 2002 3:38 PM by vbatista

    M-N relationship error -xdoclet

      Hello!
      I am having problems while creating a M-N relationship using xdoclet. I am using jboss3.0.0 with bundled Tomcat 4.0.3.

      I am getting the following exception for both roles:
      org.jboss.deployment.DeploymentException: Both roles of a relation-table mapped
      relationship must have key fields: ejb-relation-name=User-Role

      My xdoclet tags are:

      Role:
      @ejb:interface-method view-type="local"
      @ejb:relation name="User-Role"
      role-name="Role-Has-Many-Users"
      @jboss:relation-table table-name="xpto"
      create-table="true" remove-table="true"
      @jboss:target-relation related-pk-field="id"

      UserBean:
      @ejb:relation name="User-Role"
      role-name="User-Has-Many-Roles"
      @jboss:relation-table table-name="xpto"
      @jboss:target-relation related-pk-field="id"


      I have tried with "jboss:relation" instead of "jboss:target:relation" but with the same results.

      Can any one help me, please?

      Thank you in advance,
      Victor Batista

        • 1. Re: M-N relationship error -xdoclet
          fnarz

          AFAIK the XDoclet Tag should look something like this:

          * @jboss:target-relation related-pk-field="id"
          * fk-column="userBean_id"

          Take a look at the samples in:
          %XDOCLET_HOME%\samples\src\java\test\ejb\cmr\

          Regards
          Thimo

          • 2. Re: M-N relationship error -xdoclet

            Hello!
            Thanks for your reply!

            My new settings are:

            UserBean:
            #####
            @ejb:relation name="User-Role"
            role-name="User-Has-Many-Roles"
            @jboss:relation-table table-name="xpto"
            @jboss:target-relation related-pk-field="id"
            fk-column="roleid"
            #####
            where "id" is the name of the primary key on the Role bean
            and "roleid" is the name of the column in the relation table (xpto).

            RoleBean:
            #####
            @ejb:relation name="User-Role"
            role-name="Role-Has-Many-Users"
            @jboss:relation-table table-name="xpto"
            create-table="true"
            remove-table="true"
            @jboss:target-relation related-pk-field="id"
            fk-column="userid"
            #####
            where "id" is the name of the primary key on the User bean
            and "userid" is the name of the column in the relation table (xpto).

            I am using jboss3.0.0 with bundled tomcat 4.0.3. I am also using xdoclet 1.1.2. I have read on this forum that someone had to upgrade xdoclet form cvs to a newer version. Can any one confirm this?

            Any help would be welcome.

            Thanks in advance,
            Victor Batista