Re: get ID of the inserted record

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Nov 04 2004 - 10:31:16 EST

  • Next message: Robert Zeigler: "no datamap found???"

    > Dear all,
    >
    > Whoever has patience to answer to the subject: how do I get a ID of the
    > inserted record (don't seem to find this in the docs).
    >
    > Thank you.
    > Dmitry.

    Dmitry,

    ID values are encapsulated as ObjectId (dataObject.getObjectId()).
    Whatever ID was generated by Cayenne on insert will reflected in ObjectId.

    To avoid dealing with ObjectId directly I recommend using
    DataObjectUtils.intPKForObject(..):

    http://objectstyle.org/cayenne/userguide/dataobjects/dataobjectutils.html

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Nov 04 2004 - 10:31:18 EST