You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Craig Turner <cr...@synect.com> on 2006/03/31 08:41:40 UTC
Sequences for primary keys
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?
- C
Re: Sequences for primary keys
Posted by Andrus Adamchik <an...@objectstyle.org>.
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 <cr...@synect.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.
>
Re: Sequences for primary keys
Posted by Mike Kienenberger <mk...@gmail.com>.
On 3/31/06, Craig Turner <cr...@synect.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.