RE: Oracle Sequence Exception Question

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

  • Next message: Andrus Adamchik: "Re: Does Cayenne handle binary primary keys (Sybase) in relationships?"

    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?

    Thanks

    Todd

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

    Todd Costella <Todd.Costell..ntero.com> wrote:
    > > org.objectstyle.cayenne.CayenneRuntimeException: [v.1.0.1 October 13

    2003] No suitable DataNode to handle primary key generation.
    > >
    > > Below is a snippet from the <project>.map.xml
    > >
    > > <db-entity name="OMNI_TRACK_NOTES">
    > > <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
    > > <db-attribute name="SEQ" type="INTEGER" isMandatory="true"/>
    > > <db-attribute name="TEXT" type="VARCHAR" length="2000"/>
    > > <db-attribute name="note_text" type="CLOB" length="40000"/>
    > > <db-key-generator>
    > > <db-generator-type>ORACLE</db-generator-type>
    > > <db-generator-name>note_id_seq</db-generator-name>
    > > <db-key-cache-size>20</db-key-cache-size>
    > > </db-key-generator>
    > > </db-entity>
    > >
    > > This sequence exists in the Oracle 8.1.7.0.4 DB.
    > >
    > > I have not generated primary key support through the modeling tool,
    I
    > > assume I don't need to as I have existing sequences in place for my
    > > entities. I assume that I just need to specify the name of the
    sequence
    > > in the db-entity as illustrated above.

    Did you set up an Oracle data node and attach it to your DataMap?
    The DataNode contains the info that would normally be in the EOModeler
    Adaptor Info.

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Oct 21 2003 - 16:04:15 EDT