3 Replies Latest reply on Oct 15, 2004 4:48 AM by Joachim Van der Auwera

    jbosscmp-jdbc.xml syntax

    tkvarenes Newbie

      I'm trying to deploy an application with alter-table set, to update the tables in my database, but I get this error message:

      ALTER TABLE only allows columns to be added that can contain nulls or have a DEFAULT definition specified. Column 'ol_version' cannot be added to table 'STOCK' because it does not allow nulls and does not specify a DEFAULT definition.

      The definition for optimistic locking in my jbosscmp-jdbc.xml look like this:


      How can I define a default value of e.g 0?


        • 1. Re: jbosscmp-jdbc.xml syntax
          Joachim Van der Auwera Expert

          This seems to be a database specific issue.

          Try looking at/editing the conf/standardjbosscmp-jdbc.xml file. You can either change the alter table template (also see details in the wiki), or you can change the default typemappings for your database to include default values for some types (probably numeric types).


          • 2. Re: jbosscmp-jdbc.xml syntax
            tkvarenes Newbie

            There was nothing about "add column" in the MS SQL section so I tried to add

            <add-column-template>ALTER TABLE ?1 ADD COLUMN ?2 ?3</add-column-template>

            but I got an error saying:
            Invalid XML: file=file:/.../standardjbosscmp-jdbc.xml

            Any Ideas?

            • 3. Re: jbosscmp-jdbc.xml syntax
              Joachim Van der Auwera Expert

              The order of the items is important.

              If nothing was in the file, then the default template is used, so just adding this template will not be enough as it still doesn't set any of the constraints on the fields.

              Unfortunately my knowledge of MS SQL is insufficient to give specific help.

              However, I constantly use this for feature for the Firebird database, and have changed the default type mappings to include default values to prevent similar issues. You may have a look there.

              Once you have got working changes, please submit the modifications as a bug report.