Re: primary key generation

From: Mike Kienenberger (mkienen..laska.net)
Date: Fri Sep 24 2004 - 12:14:59 EDT

  • Next message: Andrus Adamchik: "Re: Deploy to Resin throws config error"

    Jonathan Carlson <Jonathan.Carlso..atun.com> wrote:
    > Am I right in assuming that, after the commit, I should be able to
    > discover the new primary key value by asking the instance (I still have
    > a reference to it) for it's ObjectId? I'm really just asking if there
    > is some gotcha that I need to be aware of in this situation.

    That should work, but I'm philosophically opposed to application code
    translating the ObjectId to the database primary key.
    I'd recommend that you use the new DataObjectUtils.pkForObject methods since
    there has never been an explicit contract stating that ObjectId will map
    directly to primary key, and if things change, this code will change to
    match it.

    -Mike



    This archive was generated by hypermail 2.0.0 : Fri Sep 24 2004 - 12:14:05 EDT