2 Replies Latest reply on Mar 8, 2005 10:39 PM by Hamdy Farid

    auto-increment template not found

    Hamdy Farid Newbie

      Hi,
      I am kinda new to the jboss world so please execuse my ignorance

      I have a CMP bean that have an auto-genrated Integer id
      I followed all the recommendation I was able to find in this forume (greate stuff by the way)

      In my jbosscmp-jdbc.xml, I have the following


      <ejb-name>BeanName</ejb-name>
      <create-table>true</create-table>

      <table-name>table_name</table-name>

      <cmp-field>
      <field-name>id</field-name>
      <column-name>id</column-name>

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

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>varchar(32)</sql-type>

      </cmp-field>

      <entity-command name="informix-serial" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCInformixCreateCommand">
      </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->

      I guess you already figured that I use informix

      the problem show up when I deploy my stuff, I get the following error

      java.lang.IllegalStateException: auto-increment template not found
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.addField(JDBCStartCommand.java:924)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.getEntityCreateTableSQL(JDBCStartCommand.java:743)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.execute(JDBCStartCommand.java:196)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.startStoreManager(JDBCStoreManager.java:484)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:381)
      at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:157)
      at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:340)

      I really don't know what is missing.... can you please help

      Thanks

        • 1. Re: auto-increment template not found
          Frank Langelage Master

          The mapping entry for InformixDB in standardjbosscmp-jdbc.xml is missing an entry like

          <auto-increment-template>?1</auto-increment-template>
          .
          This is used for the create table command.


          • 2. Re: auto-increment template not found
            Hamdy Farid Newbie

            Thanks a lot, that worked fine
            I noticed that the <auto-increment> ..... <./> is sometimes set to
            ?1 IDENTITY and sometimes to ?1 auto_increment (what is the diffrenece??)

            it worked fine at the deployment BUT
            I could not create new entity, I am getting exception from the informix (inserting null value into key)
            22:17:50,126 ERROR [MyEntity] Could not create entity
            java.sql.SQLException: Primary key on table (mytable) has a field with a null key value.
            at com.informix.jdbc.IfxSqli.addException(IfxSqli.java:3082)
            at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java:3396)
            at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2259)
            at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2179)
            at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:721)
            at com.informix.jdbc.IfxResultSet.executeUpdate(IfxResultSet.java:305)
            at com.informix.jdbc.IfxStatement.executeUpdateImpl(IfxStatement.java:882)

            Can anybody help please...

            Thanks