3 Replies Latest reply on Jul 6, 2005 10:05 AM by Ulf Schroeter

    Column XXXX cannot be null. why not Default value?

    Sven Wappler Newbie

      Hi, i have a problem with my mysql database-table. Im using jboss 4.0.2 final and MySQL 4.1.12a-nt.
      If jboss creates a record, jboss says:

      java.rmi.ServerException: EJBException:; nested exception is:
       javax.ejb.EJBException: Could not create entity:java.sql.SQLException: Column 'activated' cannot be null
      

      If i want to create an EJB i must set several values, with are NOT NULL. For example my Primary Key is created by the auto-increment function of my table. That works.
      But i have other columns which are NOT NULL but have a default value. So the sense of a default value is, that they are used, if no value is set.
      How can i tell jboss, that it doesn't set any value (only on creating)? Or there are other solutions?

      An example-field is:
      <cmp-field>
       <field-name>activated</field-name>
       <column-name>activated</column-name>
       <not-null />
       <jdbc-type>CHAR</jdbc-type>
       <sql-type>CHAR</sql-type>
       </cmp-field>


      Thanks for help.