Re: Sequences for primary keys

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Mar 31 2006 - 11:24:34 EST

  • Next message: Dave Merrin: "BindException"

    1. A "default" PK generation strategy is thread-safe within a JVM.
    Most adapters (except for generic JdbcAdapter) also implement proper
    locking for cross-JVM concurrency.

    2. 'Auto-increment' (aka "Database-Generated" PK) strategy is
    supposedly thread-save (but its behavior depends on the database, not
    Cayenne):

    http://objectstyle.org/confluence/display/CAYDOC/Generated+Columns

    3. 'Custom Sequences' strategy only works if the default strategy for
    a given adapter is also a sequence. And of course it is thread-safe.

    Andrus

    On Mar 31, 2006, at 6:38 PM, Mike Kienenberger wrote:

    > On 3/31/06, Craig Turner <crai..ynect.com> wrote:
    >> I notice there's an 'auto-incremented' feature for primary keys in
    >> the
    >> modeler - is this thread-safe? Also, would it be possible for us
    >> to be
    >> able to manage custom sequences through the cayenne modeler in a
    >> future
    >> version?
    >
    > Support for sequences predates support for auto-incrementing fields.
    > Only certain databases support sequences though.
    >
    > Auto-increment and sequences as well as database-independent (pk
    > table) primary key generation are supported in the current modeler.
    >



    This archive was generated by hypermail 2.0.0 : Fri Mar 31 2006 - 11:25:00 EST