1 Reply Latest reply on Dec 8, 2003 7:29 AM by Juha Lindfors

    jbosscmp-jdbc.xml unknown-pk problem

    vovan_onjava Newbie

      Hello all!
      I run into problem trying to write jbosscmp-jdbc.xml to be able to use autogenerated primary keys from postgreSQL. In the following example unknown-pk and auto-increment elements are defined:


      <ejb-name>XXX</ejb-name>
      <table-name>xxx</table-name>

      <cmp-field>
      <field-name>ID</field-name>
      <column-name>ID</column-name>
      <auto-increment/>
      </cmp-field>

      <cmp-field>
      <field-name>AAA</field-name>
      <column-name>aaa</column-name>
      </cmp-field>
      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <field-name>ID</field-name>
      <column-name>ID</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="mysql-get-generated-keys"/>


      But if we have a look at http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd
      then the definition for ENTITY is:

      <!ELEMENT entity (ejb-name, (datasource, datasource-mapping)?, create-table?,
      remove-table?, read-only?, read-time-out?, row-locking?,
      pk-constraint?, read-ahead?, list-cache-max?, fetch-size?, table-name?,
      cmp-field*, load-groups?, eager-load-group?, lazy-load-groups?,
      query*)>

      As you can see, there is no element unknown-pk or auto-increment defined in that schema. My question is what shall I do to solve this problem? Maybe I have to define unknown-pk and autoincrement in some other place?

      cheers,
      Vladimir.