Cayenne, MySQL and PK generation strategies

From: Marek Stanisław Wawrzyczny (marek_wawrzyczn..nternode.on.net)
Date: Tue Jul 27 2010 - 02:40:32 UTC

  • Next message: Andrus Adamchik: "Re: Cayenne, MySQL and PK generation strategies"

    Hi all,

    It has been a while since I last posted in this forum.

    First, a bit of a background. We have an existing MySQL schema that was driven by a number of WebObjects applications. These obviously rely on EOF to handle PK generation.
    We have decided to refactor the schema in a new database. The new web applications are Cayenne based.

    We now have a bit of discussion on how to handle PK generation in the new schema. My personal preference is auto incrementing PK columns. It certainly allows for a more generic approach to the handling of primary keys - it is not necessary for people to be aware of any additional infrastructure should records be inserted outside of any applications.

    Others have expressed concern with MySQL handling of the LAST_INSERT_ID() functionality where there used to be (still is?) a problem with MySQL's threading implementation in high concurrency/volume environments. (I presume this is precisely the mechanism used by Cayenne to populate IDs within the Entities?)
    Another cited advantage being suggested is that this approach allows for a vendor-independent PK generation strategy.

    I guess my vested interest here is to dismiss arguments against the use of the auto incrementing PK strategy :) but that said, I'm very interested to hear whether anyone has done any performance analysis or has had particular problems with either strategy.

    Cheers,

    Marek Wawrzyczny
    ish group



    This archive was generated by hypermail 2.0.0 : Tue Jul 27 2010 - 02:41:10 UTC