0 Replies Latest reply on Jun 9, 2005 5:49 AM by gabi munti

    default column values

    gabi munti Newbie

      i have the following sql table:
      create table portalComponent (
      id integer unsigned not null auto_increment,
      name varchar(60),
      type smallint unsigned not null default 1,
      defaultFontName varchar(50) not null default 'Verdana',
      defaultFontSize smallint unsigned not null default 12,
      defaultFgColor char(7) not null default '#000000',
      defaultBgColor char(7) not null default '#ffffff',
      primary key(id)
      );

      in ejbCreate i want to put only 1 method setName(...).
      for the rest of the columns it should put the values default.

      in jbosscmp-jdbc.xml i have the following for this:

      <cmp-field>
      <field-name>fontName</field-name>
      <column-name>defaultFontName</column-name>
      <not-null/>

      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>varchar(50) not null default 'Verdana'</sql-type>

      </cmp-field>

      the error it gives me is:
      12:31:55,254 ERROR [PortalComponent] Could not create entity
      java.sql.SQLException: Column 'defaultFontName' cannot be null

      thank you in advance