0 Replies Latest reply on Oct 3, 2004 5:56 AM by rajs1

    CMP with Compound Primary Key (Bug?)

    rajs1

      I have a CMP ContactOrgList with a compound primary key as follows:


      public class ContactOrgPK implements java.io.Serializable
      {
      public String category_code = null;
      public Long contact_org_id = null;

      public ContactOrgPK()
      {
      }

      public ContactOrgPK(Long contact_org_id, String category_code)
      ...


      The corresponding ejb-jar.xml entry is:


      <ejb-name>ContactPersonList</ejb-name>

      ...
      <persistence-type>Container</persistence-type>
      <prim-key-class>ContactPersonPK</prim-key-class>
      <reentrant>False</reentrant>
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ContactPersonList</abstract-schema-name>
      <cmp-field>
      <description/>
      <field-name>contactPersonId</field-name>
      </cmp-field>
      <cmp-field>
      <description/>
      <field-name>categoryCode</field-name>
      </cmp-field>

      ...


      However I get the following in JBoss:


      10:16:01,109 DEBUG [Organisation#findAll] Executing SQL: SELECT DISTINCT t0_c.ORG_ID FROM CONTACT_ORGANISATION t0_c
      10:16:01,171 DEBUG [Organisation] Executing SQL: SELECT NAME, VERSION_NUMBER FROM CONTACT_ORGANISATION WHERE (ORG_ID=?)
      10:16:01,265 DEBUG [ContactOrgList#findByContactOrgId] Executing SQL: SELECT DISTINCT FROM CONTACT_ORG_CONTACT_LIST t0_c WHERE (t0_c.CONTACT_ORG_ID = ?)
      10:16:01,343 DEBUG [ContactOrgList#findByContactOrgId] Find failed
      org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
      SQL error code = -104
      Token unknown - line 1, char 18
      FROM


      Why is the compound primary key entity not being selected properly?


      SQL: SELECT DISTINCT FROM CONTACT_ORG_CONTACT_LIST t0_c WHERE (t0_c.CONTACT_ORG_ID = ?)


      I noticed these questions were asked before in this forum but never answered.

      If this is confirmed as a bug at lest I can plan a work around.

      Many thanks.

      Cheers
      -raj