UUID as primary key

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Mon Jul 10 2006 - 16:00:27 EDT

  • Next message: Christian Mittendorf: "Duplicate Key Problem"

    Is there a way to set the primary key without mapping the primary key
    as an object attribute?

    Or is there a more elegant way of handling UUID as pk?

    I have lots of tables where the pk is an UUID and the only reason why
    I have to map the primary key as an object attribute is to be able to
    set the pk to an UUID.

    // Create object
    Treatment treatment = (Treatment)
    dataContext.createAndRegisterNewObject(Treatment.class);
    // set pk as UUID
    treatment.setId(UUID.randomUUID());

    Where "setId()" is the primary key mapped as an ObjAttribute.

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



    This archive was generated by hypermail 2.0.0 : Mon Jul 10 2006 - 16:00:51 EDT