0 Replies Latest reply on Jun 25, 2003 10:11 AM by cvaughan

    Unable to find logical mapping for primary key for class: Ca

    cvaughan


      Can any one help. I am using JBoss 4.0 and I get the following error whenever I try to deploy CMP beans using primary key classes.

      [JDBCMetaDataMigrationUtil] Unable to find logical mapping for primary key class: com.sis.ejbaf.ejbs.local.categorycode.CategoryCodePK

      However when I deploy to JBoss 3.2 I have no problems what so ever.

      I am using Oracle9i that has a table on it called CM_CATEGORY_CODES and consists of 3 columns :-

      ID : This field is autogenerated by Oracle using triggers and sequences.
      CATEGORYCODE : This field is of type VARCHAR2 and has beend defined as UNIQUE.
      LONGDESCRIPTION : This field is of type VARCHAR2


      The code for CategoryCodePK is as follows :-

      public class CategoryCodePK implements Serializable
      {

      public String categoryCode;

      public String getCategoryCode()
      {
      return categoryCode;
      }

      public int hashCode()
      {
      return categoryCode.hashCode();
      }

      public boolean equals(Object other)
      {
      if ((other == null) || !(other instanceof CategoryCodePK))
      {
      return false;
      }
      CategoryCodePK otherPK = (CategoryCodePK)other;
      boolean answer = (categoryCode.equals(otherPK.getCategoryCode()));
      return answer;
      }
      }



      My ejb-jar.xml is as follows :-

      <ejb-jar>
      MyApp
      <display-name>TestApp</display-name>
      <enterprise-beans>

      <ejb-name>CM_CATEGORY_CODES</ejb-name>
      <local-home>com.sis.ejbaf.ejbs.local.categorycode.CategoryCodeLocalHome</local-home>
      com.sis.ejbaf.ejbs.local.categorycode.CategoryCodeLocal
      <ejb-class>com.sis.ejbaf.ejbs.local.categorycode.CategoryCodeEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>com.sis.ejbaf.ejbs.local.categorycode.CategoryCodePK</prim-key-class>
      <cmp-version>2.x</cmp-version>
      False

      <abstract-schema-name>CM_CATEGORY_CODES</abstract-schema-name>
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>categoryCode</field-name></cmp-field>
      <cmp-field><field-name>longDescription</field-name></cmp-field>

      </enterprise-beans>
      </ejb-jar>



      My jbosscmp-jdbc.xml is as follows :

      <jbosscmp-jdbc>
      <enterprise-beans>

      <ejb-name>CM_CATEGORY_CODES</ejb-name>
      <table-name>CM_CATEGORY_CODES</table-name>
      <pk-constraint>true</pk-constraint>
      <cmp-field>
      <field-name>id</field-name>
      <column-name>ID</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      <read-only>true</read-only>
      </cmp-field>

      <cmp-field>
      <field-name>categoryCode</field-name>
      <column-name>CATEGORYCODE</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(2)</sql-type>
      <read-only>true</read-only>
      </cmp-field>

      <cmp-field>
      <field-name>longDescription</field-name>
      <column-name>LONGDESCRIPTION</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR2(28)</sql-type>
      <read-only>true</read-only>
      </cmp-field>

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

      Any suggestions would be appreciated. Thank you.