Re: violates not-null constraint question.

From: WONDER (mmmmmmmmm5..eb.de)
Date: Sat Mar 11 2006 - 18:10:37 EST

  • Next message: Mike Kienenberger: "Re: violates not-null constraint question."

    It does not looks like you expliand. It is exactly as you explaind.
    No i didnt recreate the table and i wont do that.

    I want to have it "disallow null" in DB and "allow null" in the model.
    The default value in the DB should insert the default value.

    The problem is Cayenne sends "NULL" to DB.

    I dont think its good style to use NULL at all in Cayenne. According to
    sending NULL to db mean
    I have no way to use the defaul value feature of the DB. This is nonsence,
    isnt it?

    Sako.

    ----- Original Message -----
    From: "Mike Kienenberger" <mkienen..mail.com>
    To: <cayenne-use..bjectstyle.org>
    Sent: Saturday, March 11, 2006 10:33 PM
    Subject: Re: violates not-null constraint question.

    It looks like you have set the is_active field as "allows null" in the
    modeler, but you have set the database constraints to be "disallows
    null".

    Have you tried recreating the table after making the mandatory change?
      Or altering the table column to be nullable?

    -Mike

    On 3/11/06, WONDER <mmmmmmmmm5..eb.de> wrote:
    > Hello,
    >
    > CREATE TABLE account
    > (
    > id int4 NOT NULL,
    > username varchar(50) NOT NULL,
    > "password" varchar(100) NOT NULL,
    > is_checked bool DEFAULT false,
    >
    > ...
    >
    > In the Model i have unchecked DbEntity.Mandatory for "is_active" to
    false.
    >
    > I get this error
    >
    > ERROR: null value in column "is_active" violates not-null constraint
    >
    > Is there any way to get arround this?
    >
    > I really dont know what sence does it make to send a NULL value to the DB
    as
    >
    > ----------------------------------------------------------------
    >
    > INSERT INTO public.account (id, inactive_username, is_active, is_checked,
    > password, username) VALUES (?, ?, ?, ?, ?, ?)
    >
    > [batch bind: 47, NULL, NULL, 'false', '*****', 'XXXXX']
    >
    > ----------------------------------------------------------------
    >
    > It makes the default value technique useless, i hope there is way to
    disable
    > this.
    >
    >
    >
    > Sako.
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Mar 11 2006 - 18:08:15 EST