2 Replies Latest reply on Dec 4, 2003 2:11 AM by radl01

    Not null columns problem

    radl01

      Hi all,

      I have a very simple problem. Our data model consists from many (more than 100) tables and each of these tbales have many not null columns. We try to use CMP EB to manage DB persistance and we are in trouble with the not null columns. Update is OK but in insert we always get SQL exception when we try to store null value into not null columns. I think that the problem is in create method of EB. We define the create method with one param (PK) and in postCreate we store CMR as param. But what shell we do with the other fields that are define as not null in DB ? Is it the must to define these fields in create method ? We use JBuilder to generate EB from DB schema and it is a hard work to rewrite all create method and put it there all not null columns.

      Thanks for help

      Jan

        • 1. Re: Not null columns problem
          zahid14

          Call set<NOT_NULL_FIELD>(SOME DATA) in the ejbCreate method for all not null columns.

          Example: if column is Customer then
          public java.lang.String ejbCreate(java.lang.String fileName) throws CreateException {
          setFileName(fileName);
          setCustomer(""); //-----
          return null;
          }

          • 2. Re: Not null columns problem
            radl01

            Thank you very much. I have exactly the same idea. I works great.

            But what about remove method. I have jumped in the same problem with not null columns. I do not understand why update statement is called before remove method.

            Any idea ?

            Jan