2 Replies Latest reply on Apr 29, 2002 4:35 AM by marr

    CMR, CMP and entity bean using different tables

    marr


      Hello!

      I use CMP2.0 with JBoss3.0 beta an Oracle8i.

      Could anybody tell me if it is possible to have the following scenario, and how should deployment descriptors be done so that this works:

      Entity1 is in relation 1:n with Entity
      Entity2 is in relation 1:n with Entity

      but I want for each relation the bean Entity to use a different table.

      Any ideas will be greatlly apreciated.
      Thank's.



        • 1. Re: CMR, CMP and entity bean using different tables
          shogun

          This example works with version 3.0 RC1. I don't know, if it works with the beta version. This example is based on table mapping:

          employee 1 -* telecom.

          table employee:
          -> column employee_id

          table employee_telecom:
          -> column employee_id_fk
          -> column telecom_id_fk

          table telecom:
          -> column telecom_id

          An other relation like customer 1-* telecom is also possible with this design.

          <ejb-relation>
          <ejb-relation-name>employee-telecom</ejb-relation-name>
          <relation-table-mapping>
          <table-name>employee_telecom</table-name>
          </relation-table-mapping>
          <ejb-relationship-role>
          <ejb-relationship-role-name>one-employee-has-many-telecoms</ejb-relationship-role-name>
          <key-fields>
          <key-field>
          <field-name>id</field-name>
          <column-name>employee_id_fk</column-name>
          </key-field>
          </key-fields>
          </ejb-relationship-role>
          <ejb-relationship-role>
          <ejb-relationship-role-name>one-telecom-has-one-employee</ejb-relationship-role-name>
          <key-fields>
          <key-field>
          <field-name>id</field-name>
          <column-name>telecom_id_fk</column-name>
          </key-field>
          </key-fields>
          </ejb-relationship-role>
          </ejb-relation>

          Shogun

          • 2. Re: CMR, CMP and entity bean using different tables
            marr

            Thank's a lot. I tried as you said and it worked also with the beta version. The only problem is that the tables for relations are not deleted when undeploy is done, but I understood this problem is solved in 3.0 RC1 version.

            marr