2 Replies Latest reply on Jul 5, 2002 4:39 PM by jackxwu

    compound primary key not allowed in 3.0?

    jackxwu

      i suppose my JBoss 2.4.4 ejb jar files would just work fine under 3.0 JBoss server, but i got exceptions at 3.0 server start up time
      --------------
      org.jboss.deployment.DeploymentException: Error in ejb-jar.xml for Entity Bean Taskvariable: primkey-field is not a cmp-field
      at org.jboss.metadata.ApplicationMetaData.importEjbJarXml(ApplicationMetaData.java:191)
      at org.jboss.metadata.XmlFileLoader.load(XmlFileLoader.java:151)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:326)
      .......
      ---------------------------------------------------

      and when i verify the jar file under 3.0 server i received the following errors:

      ----------------------------------
      Verifying ejb module Untitled [role=developer]
      #### Error: [Untitled] Entity Bean "Taskvariable"
      Could not find container managed field corresponding to primary-key-field:

      #### Warning: [Untitled] Entity Bean "Taskvariable"
      It is unusual to specify a primary key field for a
      wrapper primary key class containing public fields:
      xb, state=, indent= 0 113/131 <public int taskid;>
      Consider omitting the primary key field declaration
      --------------------------------------------------

      i have three public variables on Entity Bean "Taskvariable", and i use a compound primary key which contains all three variables.

      i guess the verifier complains as it cannot find a CMP field corresponding to the primary key.

      as i said, this jar file works under 2.4.4. any help will be apreciated

        • 1. Re: compound primary key not allowed in 3.0?
          dsundstrom

          The verifier in 3.0 is still a work in progress. Verifiers are always the last thing written.

          It looks like the verifier is saying that you have a custom primary key, yet you still have a prim-key-field declaration in your ejb-jar.xml file. If you have a custom primary key class you do not need a prim-key-field declaration (actually, I don't think you are allowed to have the field declaration).

          Either way, this is a very ugly error message, so you should post a bug report at sourceforge, and the guy who maintains the verifier will fix it.

          • 2. Re: compound primary key not allowed in 3.0?
            jackxwu

            Thanks for the quick response.

            i do have a <primkey-field/> entry in my ejb-jar.xml file.
            the exception went away after i remove the entry.

            i think the error massages are fine, but the program should be more forgiving as <primkey-field/> means the same as not having such an entry. because it is an empty element anyway.