RE: Oracle Sequence Exception Question

From: Todd Costella (Todd.Costell..ntero.com)
Date: Tue Oct 21 2003 - 16:52:28 EDT

  • Next message: Axel HONFI: "java.sql.SQLException: JZ0TE: Attempted conversion between an illegal pair of types."

    The problem was that the ID was set up as an entity in the class. When I
    removed it, everything worked great.

    Thanks for the help Mike, hopefully my bublings and your answers will
    help someone else in the future.

    Todd

    -----Original Message-----
    From: Mike Kienenberger [mailto:mkienen..laska.net]
    Sent: Tuesday, October 21, 2003 2:44 PM
    To: Todd Costella
    Cc: cayenne-use..bjectstyle.org
    Subject: Re: Oracle Sequence Exception Question

    Todd Costella <Todd.Costell..ntero.com> wrote:
    > Well, that makes sense now doesn't it. You mean the model doesn't
    figure
    > this out by itself by reading my mind? <grin>
    >
    > I'm gettng closer. The exception I currently get is
    >
    > <snip>
    >
    > Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into
    > ("OMNI_TRACK"."OMNI_TRACK_NOTES"."ID")
    >
    > </snip>
    >
    > The id column is the primary key that should be populated by the
    > sequence relationship defined below. I am assuming that the framework
    > will populate the column in the insert via the sequence given the
    > relationship. Is this true or do I have do perform a "set" on the id
    > after making a call to generate the sequence myself?

    If it's marked in the model as a non-class attribute (ie, no object
    entity
    attribute for the primary key) and a primary key, and you've specified
    the
    oracle sequence info, it should be automatic.

    Also, if you're using sequences generated by WebObjects, they are
    probably
    set up with an increment value of 1, not the increment value of 20 which
    is
    the default in the Cayenne modeler. Unfortunately I didn't keep a copy
    of
    your original message so I don't remember to what you had it set.



    This archive was generated by hypermail 2.0.0 : Tue Oct 21 2003 - 16:52:29 EDT