4 Replies Latest reply on Jul 20, 2005 12:21 AM by r k

    How to make primitive types accept null values in jbosscmp-j

    r k Newbie

      Hi,
      I am a beginner with Jboss and I am trying to crete a CMP entity bean with JBoss-4.0.2. The requirement is that only the primary key field is not null and the others could be null.
      The problem is whenever i declare any integer fields, jboss creates them as not-null fields. When i call the create method on the entity bean it throws an error. Because some of the fields are not null fields(fields other than the pk). Is there anyway I can override this??? Thanks for all ur help.
      My jbosscmp-jdbc.xml looks like this
      <jbosscmp-jdbc>

      <enterprise-beans>

      <ejb-name>cabinEJB</ejb-name>
      <table-name>cabin</table-name>
      <cmp-field>
      <field-name>shipId</field-name>
      <column-name>shipId</column-name>

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

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

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

      </cmp-field>
      <cmp-field><!--PRIMARY KEY-->
      <field-name>id</field-name>
      <column-name>id</column-name>
      <not-null/>
      </cmp-field>

      </enterprise-beans>

      </jbosscmp-jdbc>