0 Replies Latest reply on Aug 30, 2001 2:01 PM by Gerd Pranoto

    Problem with primary key data type

    Gerd Pranoto Newbie

      Hi all,

      I'm an EJB/Jboss newbie. Took me 2 days to get it up and running. Right now I am trying to create my own simple entity bean. The problem that I'm having right now is when querying by primary key (findByPrimaryKey(...)), I keep getting
      "SQLException Invalid Descriptor Index"

      Through further investigation, I found out that somehow my primary key is being treated as varchar instead of integer. Included below is how I defined my primary key in jaws.xml and ejb-jar.xml

      --- from jaws.xml
      <cmp-field>
      <field-name>country_id</field-name>
      <column-name>country_id</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>

      -- from ejb-jar.xml

      Models a Country
      <ejb-name>Country</ejb-name>
      country.CountryHome
      country.Country
      <ejb-class>country.CountryBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <cmp-field><field-name>country_id</field-name></cmp-field>
      <cmp-field><field-name>provider_id</field-name></cmp-field>
      <cmp-field><field-name>description</field-name></cmp-field>
      <cmp-field><field-name>use_state</field-name></cmp-field>
      <primkey-field>country_id</primkey-field>


      What did I do wrong?
      Any help would be greatly appreciated.

      Gerd