0 Replies Latest reply on Jun 9, 2003 7:01 AM by siddharthyadav

    CMP2.0 With JBoss 3.0.6

    siddharthyadav Newbie

      I am trying to write a Entity bean which will map to more than one database table.Can anyone help me give the jbosscmp-jdbc.xml for this the one wrote was something like this

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmpjdbc_3_0.dtd">
      <jbosscmp-jdbc>
      <enterprise-beans>

      <ejb-name>ECitizenEntity</ejb-name>
      <table-name>ppecitizen</table-name>
      <cmp-field>
      <field-name>contactId</field-name>
      <column-name>contact_id</column-name>
      <not-null/>
      </cmp-field>
      <cmp-field>
      <field-name>intECitizenId</field-name>
      <column-name>int_ecitizen_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>eCitizenId</field-name>
      <column-name>ecitizen_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>onlineContactId</field-name>
      <column-name>online_contact_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>password</field-name>
      <column-name>password</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>secretQuestion</field-name>
      <column-name>secret_question</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>secretAnswer</field-name>
      <column-name>secret_answer</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>contactType</field-name>
      <column-name>contact_type</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>status</field-name>
      <column-name>status</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>noOfFailTries</field-name>
      <column-name>no_of_fail_tries</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>title</field-name>
      <column-name>title</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>firstName</field-name>
      <column-name>firstname</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>lastName</field-name>
      <column-name>lastname</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>aliasName</field-name>
      <column-name>alias_name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>gender</field-name>
      <column-name>gender</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>dateOfBirth</field-name>
      <column-name>birth_date</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>houseNumber</field-name>
      <column-name>house_number</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>addr1</field-name>
      <column-name>addr1</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>addr2</field-name>
      <column-name>addr2</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>addr3</field-name>
      <column-name>addr3</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>addr4</field-name>
      <column-name>addr4</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>addr5</field-name>
      <column-name>addr5</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>postCode</field-name>
      <column-name>postcode</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>prv</field-name>
      <column-name>private</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>userId</field-name>
      <column-name>user_id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>serviceSubscriptionFailTries</field-name>
      <column-name>serv_subscptn_fail_tries</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>questionFailTries</field-name>
      <column-name>questn_fail_tries</column-name>
      </cmp-field>
      <!-- Load Groups -->
      <!-- Queries -->

      <!-- Another entity tag for the new table -->

      <!-- The entity name same as above -->
      <ejb-name>ECitizenEntity</ejb-name>
      <!-- New Table name
      <table-name>ppanother table</table-name>
      <cmp-field>
      <field-name>name</field-name>
      <column-name>name</column-name>
      <not-null/>
      </cmp-field>


      </enterprise-beans>
      </jbosscmp-jdbc>

      with the above descriptor i was able to deploy the entity bean however at run time it gave me an exception as the parser was looking for the primary key in the other table whereas the primary key was not meant to be in the other table.
      Is this a general practise Can anyone please share the descriptor for the entity which will map to more than one table