3 Replies Latest reply on Dec 23, 2003 9:22 PM by veemal

    "auto-increment" Not Recognised

    veemal Newbie

      Hi All,

      I'm using Jboss 3.2.3. I have a table in MSSQL which is having an auto-incrementing field as primary key.
      Im my jbosscmp-jdbc.xml, I have the following declarations to cater for the auto-increment field:

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

      <entity-command name="mssql-fetch-key"/>


      But then, when I deploy my application, JBoss throws the following exception:

      121. Error message: Element type "auto-increment" must be declared.
      21:39:36,938 ERROR [XmlFileLoader] XmlFileLoader: File jar:file:/E:/cvs/jboss-3.2.3-src/build/output/jboss-3.2.3/server/default/tmp/deploy/tmp30365ProcessOrder.jar!/META-INF/jbosscmp-jdbc.xml process error. Line:
      122. Error 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+)?)".


      The auto-increment element type is not being recognised, and jboss seems to be complaining wrongly, coz according to the jbosscmp-jdbc_3_2.dtd :
      <!ELEMENT cmp-field (field-name, read-only?, read-time-out?,
      column-name?, not-null?, ((jdbc-type, sql-type) | (property+))?,
      auto-increment?, dbindex?, check-dirty-after-get?, state-factory? )>


      Does anybody has a clue why this is so? I've searched through the forum and checked out the pay-for docs, and I seem to be the only one having this issue.

      Thanks!

        • 1. Re:
          ongtw Newbie

          Hi all,

          I'm having exactly the same problem!!!

          Could anybody help us?

          Thank You in advance.

          • 2. Re:
            marcoyeung Newbie

            check if your jbosscmp-jdbc.xml are pointed to correct DTD.
            auto-increment/entity-command are belongs to DTD version 3.2.

            like this:
            <!DOCTYPE jbosscmp-jdbc PUBLIC
            "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN"
            "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">


            Regards
            Marco

            • 3. Re:
              veemal Newbie

              jbosscmp-jdbc.xml was actually pointing to the correct DTD.
              I added the relevant xdoclet tags :
              *@jboss.entity-command
              * name="mssql-fetch-key"

              &

              * @jboss.persistence auto-increment = "true"

              to generate the jbosscmp-jdbc.xml file, and I could deploy without any prob.

              But now, this INSERT fails because Cannot insert the value NULL into primary key column, which I pointed out under one of your posting, "Does Jboss support IDENTITY field in MSSQL SERVER / ORACLE??"