RE: Primary key and sequence

From: Laszlo Spoor (lspoor_cayenn..otmail.com)
Date: Wed Mar 09 2005 - 16:02:43 EST

  • Next message: Sami Mohammed: "RE: Primary key and sequence"

    Hi Sami,

    If you use Oracle, you can use sequences. However, you will have to tell
    your cayenne.xml using the modeler. Select your DataMap --> Select a
    database entity --> Select the Entity tab --> check 'Customize primary key
    generation' and point to your sequence here.

    Hope this helps, laszlo

    >From: "Sami Mohammed" <SMOHAMME..ndependenthealth.com>
    >Reply-To: cayenne-use..bjectstyle.org
    >To: <cayenne-use..bjectstyle.org>
    >Subject: Primary key and sequence
    >Date: Wed, 09 Mar 2005 15:22:26 -0500
    >
    >
    >Hi
    >
    >I am try to save data to the table , i have created sequenc DB, but how to
    >attached the or set sequence .
    >see the code below . when i am submit i am getting error--> sequence does
    >not exist at oracle.jdbc.dbaccess.DBError.throwSqlException
    >
    >
    > CwAddForm addCwTableForm =
    >(CwAddForm) form;
    >
    > // get session DataContext to perform database transactions
    > DataContext context =
    >BasicServletConfiguration.getDefaultContext(request.getSession());
    >
    > try
    > {
    > // create new ABC table object and register it with DataContext
    > WebCwTableList newCwTable =
    > (WebCwTableList)
    >context.createAndRegisterNewObject(WebCwTableList.class);
    >
    > // Set the attributes of theABC table object
    > newCwTable.setCwTableName(addCwTableForm.getTableName());
    > newCwTable.setCwTableDesc(addCwTableForm.getTableDesc());
    > newCwTable.setCwObjectName(addCwTableForm.getObjectName());
    > newCwTable.setLastChngDate(new Date());
    > newCwTable.setLastUsrKey(user.getUserKey());
    >
    > // commit all the changes to the database
    > context.commitChanges();
    >
    > }
    > catch (Exception e)
    > {
    > context.rollbackChanges();
    > errors = CwUtils.processException(errors, e);
    > }
    >
    >
    >Thanks
    >sami
    >
    >CONFIDENTIALITY NOTICE. This e-mail and attachments, if any, may contain
    >confidential information which is privileged and protected from disclosure
    >by Federal and State
    >confidentiality laws rules and regulations. This e-mail and attachments,
    >if any, are intended for the designated addressee only. If you are not the
    >designated addressee, you
    >are hereby notified that any disclosure, copying, or distribution of this
    >e-mail and its attachments, if any, may be unlawful and may subject you to
    >legal consequences. If you
    >have received this e-mail and attachments in error, please contact
    >Independent Health immediately at (716) 631-3001 and delete the e-mail and
    >its attachments from your
    >computer. Thank you for your attention
    >

    _________________________________________________________________
    FREE pop-up blocking with the new MSN Toolbar - get it now!
    http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



    This archive was generated by hypermail 2.0.0 : Wed Mar 09 2005 - 16:02:46 EST