1 Reply Latest reply on Feb 6, 2003 6:37 AM by skoteinos

    No CMR support with JBoss 3.2 get-generated-keys

    bobo1025

      org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationM
      etaData throws a DeploymentException with the
      errormessage "Atleast one role of a foreign-key mapped
      relationship must have key fields" when <primkey-field>
      is missing in ejb-jar.xml.

      I am using 'get-generated-keys' method to use database auto-increment column as the primary key. By requirement, no <primkey-field> cat be inserted in ejb-jar.xml. There is no way to deploy the EJB jar file.

        • 1. Re: No CMR support with JBoss 3.2 get-generated-keys
          skoteinos

          Hi

          I had nearly the same problem. I use an unknown primary key and a key-generator (at the bottom you can see the relevant code). The trick there is to include a <field-name> Element into the <unknown-pk> Element, than you can reference this PK in a relationship :

          <key-fields>
          <key-field>
          <field-name>somePK</field-name>
          <column-name>someFK</column-name>
          </key-field>
          </key-fields>

          I hope this helps.
          Greets

          ------------------------------------------------
          <unknown-pk>
          <unknown-pk-class>java.lang.String</unknown-pk-class>
          <field-name>somePK</field-name>
          <column-name>somePK</column-name>
          <jdbc-type>VARCHAR</jdbc-type>
          <sql-type>VARCHAR(32)</sql-type>
          </unknown-pk>

          <entity-command name="KEY-GEN"
          class="org.jboss.ejb.plugins.cmp.jdbc.JDBCKeyGeneratorCreateCommand">

          UUIDKeyGeneratorFactory

          </entity-command>