Re: Auto generated column, how to not insert null

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jan 15 2005 - 21:31:50 EST

  • Next message: Jürgen Saar: "Re: Auto generated column, how to not insert null"

    Hi Mike,

    I am currently working on finalizing the auto-generated columns code.
    This should be released in the next 1.2 milestone. I will still need to
    test it with default column values. I wonder if the mechanism for value
    retrieval of "default" columns is the same as for generated keys (as in
    addition to skipping such columns in INSERT we need to pass default
    value back to the object on commit)...

    For now I guess the workaround is to set this property explicitly to a
    non-null value, e.g. in validateForInsert() or in
    setPersistenceState().

    Andrus

    On Jan 15, 2005, at 7:07 PM, Mike D Pilsbury wrote:
    > I have a column that is defined as having a default value (actually
    > CURRENT_TIMESTAMP, but it shouldn't matter). When I create a new
    > object, and it gets committed, the generated INSERT sets the column to
    > null. But this obviously stops the database from using the default
    > value.
    >
    > So what I want to know is how do I configure Cayenne so that it
    > ignores the column for INSERTs and UPDATEs, but gets it for selects? I
    > tried setting the column to Auto (isGenerated), but that appears to
    > have no effect. I know that Hibernate supports this. so I don't doubt
    > that Cayenne does too.
    >
    > I am a newbie to Cayenne, so I am sure that it is something simple
    > that I am not finding, despite searching the docs and the mailing
    > list.
    >
    > Mike



    This archive was generated by hypermail 2.0.0 : Sat Jan 15 2005 - 21:31:57 EST