1 Reply Latest reply on Mar 31, 2004 11:02 AM by sysuser1

    auto-increment filed Postgresql and jbosscmp-jdbc.xml

    vitimreka

      I have jboss 3.2.3 postgresql database
      I want to deploy a CMP bean containing primary index as auto-increment database field.
      What should I write to run-time deployment descriptor jbosscmp-jdbc.xml for this ?

      And Where can I find good decription of jbosscmp-jdbc.xml file ?



        • 1. Re: auto-increment filed Postgresql and jbosscmp-jdbc.xml
          sysuser1

          You need to use "entity-command" to get the auto-increment value after insert

          Your jbosscmp-jdbc.xml will look something like this

          <entity>
           :
           <cmp-field>
           <field-name>Some_Auto_Incrementing_Field</field-name>
           <column-name>Some_Auto_Incrementing_Column</column-name>
           <!-- Added for auto-incrementing columns -->
           <auto-increment />
           </cmp-field>
           <cmp-field>
           :
           </cmp-field> <!-- the last cmp field -->
           <!-- Added for auto-incrementing columns -->
           <entity-command name="postgresql-fetch-seq" />
           <query> <!-- the first query -->
           :
           </query>
          </entity>
          


          You can refers to JBoss Docs for more information. "standardjbosscmp-jdbc.xml" in the JBOSS_HOME/server/default/conf is a good place to start.

          Hope this helps

          VM