RE: Fetching a NextVal to be used in an insert

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Nov 03 2004 - 10:52:33 EST

  • Next message: Williams, Beth: "RE: Fetching a NextVal to be used in an insert"

    Hi Beth,

    Looks like you do not have OracleAdapter selected for the DataNode, as
    Oracle adapter calls the sequence, instead of doing a select from
    AUTO_PK_SUPPORT.

    So in the Modeler select DataNode and pick
    "org.objectstyle.cayenne.dba.oracle.OracleAdapter" from the Db Adapter
    drop down list. This should fix the problem.

    Andrus

    > I have removed the personId ObjAttribute and I have specified the right
    > sequence name on the DbEntity's page. This gets me a little further,
    > however, its still not inserting the record. I am now getting the
    > following error thus preventing the insert from occuring:
    >
    > INFO QueryLogger: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME
    > = 'PERSONS' INFO QueryLogger: *** error.
    > java.sql.SQLException: ORA-00942: table or view does not exist
    >
    > Any ideas?? Thanks.
    >
    > Beth
    >
    > -----Original Message-----
    > From: Bryan Lewis [mailto:brya..aine.rr.com]
    > Sent: Monday, November 01, 2004 3:02 PM
    > To: cayenne-use..bjectstyle.org
    > Subject: Re: Fetching a NextVal to be used in an insert
    >
    >
    > Williams, Beth wrote:
    >> The name of the Oracle sequence is PERSON_ID. The name of the DB
    >> Attribute name in the modeler is PERSON_ID. The obj Attribute name is
    >> personId. Is there somewhere in the modeler that you can specify what
    >> the sequence name is? Looking through the documentation I see a
    >> section for Generate Primary Key Support. This section refers to the
    >> Generate Database Schema option where you can specify to "Drop Primary
    >> Key Support" and "Create Primary Key Support". Does this pertain to
    >> what I am trying to do? Any additional info you can give to point me
    >> in the right direction is greatly appeciated. Thanks.
    >
    > Sounds like both issues will need fixing, the primary key being exposed
    > as an object attribute, and specifying the right sequence name. In the
    > DbEntity's page in the modeler, you'll see a section "PK Generation".
    > If you check the "Customize" box you can fill in the name of your
    > sequence.
    >
    > The "Generate Primary Key Support" that you saw in the docs is for
    > creating a database to match your model. The "PK Generation" section of
    > the DbEntity page specifies how to ask an existing Oracle database for
    > the next value. It isn't yet described in the docs as far as I know.



    This archive was generated by hypermail 2.0.0 : Wed Nov 03 2004 - 10:52:35 EST