2 Replies Latest reply on Dec 23, 2003 7:07 AM by marcoyeung

    autoincrement

    vaat Newbie

      I have a customer cmp entity bean. I want to insert a new customer through a create merthod on the home object.

      The client that invoke the insert doesn't know which customerId (primary key) to use.

      How can I autoincrement this filed with cmp, so I don't have to specify that in de create method ?

        • 1. Re: autoincrement
          invisiblemage Newbie

          in mysql use in the jbosscmp-jdbc.xml


          <ejb-name>myEJB</ejb-name>
          <table-name>myEJB</table-name>
          <cmp-field>
          <field-name>myId</field-name>
          <column-name>my_id</column-name>
          <auto-increment/>
          </cmp-field>
          <entity-command name="mysql-get-generated-keys"/>
          ...

          • 2. Re: autoincrement
            marcoyeung Newbie

            is there anyone know how to do auto-increment with SQL SERVER. I am using IDENTITY field type in SQL SERVER's table as primary key field.. how to set up JBOSS to support auto-increment in this field type???


            thanks

            Marco