Re: UUID as primary key

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Tue Aug 01 2006 - 07:23:26 EDT

  • Next message: Tore Halset: "Re: Problem with DB2 UDB"

    On 7/22/06, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > I see. That makes sense - each DataContext in a nested context chain
    > would create its own instance of object and transition it through the
    > lifecycle. So technically it is still called once per object
    > instance. However the fact that ID can be passed from a peer object
    > in the upstream context requires an extra check. E.g.:
    >
    > public void setPersistenceState(int state) {
    > super.setPersistenceState(state);
    >
    > if (state == PersistenceState.NEW && getObjectId() == null) {
    > setId(UUID.randomUUID());
    > }
    > }

    That didn't work for me. getObjectId() is never null when
    setPersistanceState() is called, AFAICT.

    Otherwise, it seems to work fine though.

    -- 
    Øyvind Harboe
    http://www.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Tue Aug 01 2006 - 07:23:55 EDT