Oracle Sequence Exception Question

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

  • Next message: Mike Kienenberger: "Re: Oracle Sequence Exception Question"

    > Hi everyone,
    >
    > I'll open my question by saying that I'm really impressed by the state
    > of this project. I've been looking for a good OR Mapping and Persistence
    > framework and it looks like Cayenne might be it.
    >
    > I'm in the process of converting an existing EO project to the Cayenne
    > framework. I decided to start from scratch instead of converting the EOModel. This is mostly so
    > I could learn how the mapping application worked.
    >
    > The mapping process went fine, and the generated code looks good. When I
    > run one of my existing (slightly Cayenneified test cases) I get the
    > following exception:
    >
    > 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.
    >
    > Here is a snippet of the test
    >
    > DataContext dc = ApplicationController.getDataContext();
    >
    > try {
    >
    > OmniTrackNotes note = (OmniTrackNotes) dc.createAndRegisterNewObject("OmniTrackNotes");
    >
    > note.setNoteText("Test Note");
    > Integer sequence = new Integer(1);
    > note.setSeq(sequence);
    > dc.commitChanges(Level.WARN);
    >
    >
    > } catch (Exception e) {
    > e.printStackTrace();
    > }
    >
    >
    > Any hints would be most welcome.
    >
    > Todd
    >



    This archive was generated by hypermail 2.0.0 : Tue Oct 21 2003 - 14:32:06 EDT