4 Replies Latest reply on Sep 23, 2003 6:25 PM by bontempo

    MSSQL Server Auto Increment

    digitalmonkey Newbie

      I am attemptng to set up an auto incrementing key field for SQL Server, but when I start JBoss I get an IllegalStateException "Auto-Increment Template Not Found" - has anyone else encountered this?

        • 1. Re: MSSQL Server Auto Increment
          viz Newbie

          Nop, but auto_increment with the latest version of mySQL and JBoss 3.2.1 work fine.

          Let me know if you need help getting it to work.

          Kind regards,
          --
          Marc

          • 2. Re: MSSQL Server Auto Increment
            viz Newbie

            Sorry - misread - thought I saw mySQL not MS...

            Kind regards,
            --
            Marc

            • 3. Re: MSSQL Server Auto Increment
              Rene Newbie

              Help me.
              I'm using PostgreSQL with the cmp2 example for the AdminDocs 3.2.1 (nice book).
              But when I insert into jbosscmp-jdbc.xml


              java:/PostgreDS
              <datasource-mapping>PostgreSQL 7.2</datasource-mapping>
              <create-table>true</create-table>
              <remove-table>false</remove-table>
              <pk-constraint>true</pk-constraint>
              <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


              I get the:
              java.lang.IllegalStateException: auto-increment template not found

              Error :(
              Can PostgreSQL do auto_increment? Or how do I define to use JBoss to do auto_increment?

              Could you tell me both ways?

              • 4. Re: MSSQL Server Auto Increment
                bontempo Newbie

                I've got the same problem in Oracle !


                <ejb-name>SiteImages</ejb-name>
                <table-name>SITEIMAGES</table-name>
                <entity-command name="get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.jdbc3.JDBCGetGeneratedKeysCreateCommand" />
                <cmp-field>
                <field-name>id</field-name>
                <column-name>ID</column-name>
                <jdbc-type>INTEGER</jdbc-type>
                <sql-type>INTEGER</sql-type>
                <auto-increment/>
                </cmp-field>
                <cmp-field>
                <field-name>idSite</field-name>
                <column-name>ID_SITE</column-name>
                </cmp-field>


                I get :
                java.lang.IllegalStateException: auto-increment template not found

                Does anyone know how to solve this ?

                If I remove the <auto-increment/> Jboss gets the ROWID as the generated key but I really need the ID value !

                THANKS