Re: "Can't get primary key from temporary id" :(

From: Tore Halset (halse..vv.ntnu.no)
Date: Wed Apr 08 2009 - 02:42:20 EDT

  • Next message: Malcolm Edgar: "Re: General queries"

    On Apr 8, 2009, at 3:28 , Aristedes Maniatis wrote:

    > On 08/04/2009, at 11:03 AM, Joseph Schmidt wrote:
    >
    >>> * write the record to database, fetch it back again and
    >>> then you'll have the primary key
    >> Than this is not the same transaction :(.
    >
    > Correct. This is a limitation of how databases work, not Cayenne.
    > You can't have a primary key until you write the record, unless you
    > do something tricky like using a nanosecond timestamp hashed with
    > the MAC address of your machine and the number you first thought of.

    UUID is a good alternative.

      - Tore.



    This archive was generated by hypermail 2.0.0 : Wed Apr 08 2009 - 02:43:12 EDT