Does CMP create relationship column?

Discussions

EJB programming & troubleshooting: Does CMP create relationship column?

  1. Does CMP create relationship column? (1 messages)

    Hi All,
    My ejb-jar.xml is as follows:

    <ejb-relation>
    <description>
    </description>
    <ejb-relation-name>AccountItem-Amortization</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>AccountItem-Has-Amortization</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>AccountItem</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>Amortization</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>Amortization-linksTo-AccountItem</ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>Amortization</ejb-name>
    </relationship-role-source>
    </ejb-relationship-role>
    </ejb-relation>

    AccountItem refers to Amortization. But Amortization doesn't refer to AccountItem. I have defined relationship as above. I didn't define anything in jbosscmp-jdbc.xml. The CMP container creates link from Amortization to AccountItem in Amortization table as AccountItem-Amortization., which I dont want. Is there any way I can avoid this?

    Any input is apprecaited!

    Thanks
    Bhaskar
  2. if you want to use a specific table, you have to specify it in the jbosscmp-jdbc.xml. In there, you can also specify if you want to use foreign keys or a mapping table (among a lot of other things). Jboss will only create the FK column if it creates the table also. if you have an existing table, you can add the fk yourself.