3 Replies Latest reply on Apr 24, 2003 10:02 PM by Oliver Greschok

    JBoss 3.2.0 and MySQL: auto-inc problem

    whywai Newbie

      Hi,
      i have been using JBoss3.2.0beta3 and xdoclet1.2b2. auto-inc pk has been working with the following xdoclet tags:
      *@ejb:pk-field
      * @ejb:persistent-field
      * @jboss:persistence auto-increment="true"
      * @ejb.column-name name="id"
      ever since i switch over to JBoss3.2.0 (april 11th), the auto-inc no longer works.
      in my deployment descriptor, i have the following:
      ...
      <cmp-field>
      <field-name>id</field-name>
      <auto-increment/>
      </cmp-field>
      ...

      and i am getting the following error when deploying:
      04:34:10,968 ERROR [XmlFileLoader] XmlFileLoader: File file:/C:/jboss-3.2.0/server/default/tmp/deplo
      y/server/default/deploy/pet.jar/29.pet.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 27. Erro
      r message: Element type "auto-increment" must be declared.
      04:34:16,984 ERROR [XmlFileLoader] XmlFileLoader: File file:/C:/jboss-3.2.0/server/default/tmp/deplo
      y/server/default/deploy/pet.jar/29.pet.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 28. Erro
      r message: The content of element type "cmp-field" must match "(field-name,read-only?,read-time-out?
      ,column-name?,not-null?,((jdbc-type,sql-type)|property+)?)".
      04:34:17,000 ERROR [XmlFileLoader] XmlFileLoader: File file:/C:/jboss-3.2.0/server/default/tmp/deplo
      y/server/default/deploy/pet.jar/29.pet.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 59. Erro
      r message: Element type "auto-increment" must be declared.
      04:34:17,000 ERROR [XmlFileLoader] XmlFileLoader: File file:/C:/jboss-3.2.0/server/default/tmp/deplo
      y/server/default/deploy/pet.jar/29.pet.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 60. Erro
      r message: The content of element type "cmp-field" must match "(field-name,read-only?,read-time-out?
      ,column-name?,not-null?,((jdbc-type,sql-type)|property+)?)".
      04:34:17,000 ERROR [EntityContainer] Starting failed
      org.jboss.deployment.DeploymentException: Invalid XML: file=file:/C:/jboss-3.2.0/server/default/tmp/
      deploy/server/default/deploy/pet.jar/29.pet.jar!/META-INF/jbosscmp-jdbc.xml
      does anyone has any idea whether auto-inc should work with the lastest JBoss 3.2.0 and mysql?

      Thanks
      Wai

        • 1. Re: JBoss 3.2.0 and MySQL: auto-inc problem
          whywai Newbie

          turns out xdoclet1.2b2 only expects up to jboss3.0.x now, so it still uses the 3.0 dtd files for deployment descriptors, i had to do the following in ant file to make it work (until new release of xdoclet i guess):







          • 2. Re: JBoss 3.2.0 and MySQL: auto-inc problem
            Lyle Eckert Newbie

            whywai, Thanks for the example on how to get this to work, I found it very useful. However I have been having problems with the auto-incrementing stuff in general, but I can't figure out what I am doing wrong. Could you do me a favor and make a zip of an example if you have one I would really appreciate it and I think some others here on the forum would appreciate it too.

            Personally I keep having a problem when I try and make a new record I get

            transaction.interfaces.BankException: Could not create account, Cause:javax.transaction.TransactionRolledbackException: Internal error setting instance field id; CausedByException is:
            null; nested exception is:
            javax.ejb.EJBException: Internal error setting instance field id; CausedByException is: null


            Any help U could give as an example ect would be appreciated.

            Thanks,
            Pup

            • 3. Re: JBoss 3.2.0 and MySQL: auto-inc problem
              Oliver Greschok Newbie

              Hi whywai,

              i have no idea in which build.xml file from the source code directorys i have to put these lines in. And not at which position in this file. Can you give me a hand.

              i have another Question :Do you have an idea how to get along with BIGINT AUTO-INCREMENT converting to "java LONG" with
              <entity-command name="mysql-get-generated-keys"/> without getting a classcast-Exception by the selfgenerated getId ?

              Thanx vc.20