Problem:

I'm using Cayenne for projects where I can't modify the database
schema on the server.

These databases use server generated primary keys. MSAccess, MS SQL
Server and Oracle.

The number of new records created are very small(max 1/minute), so I'm
rather insensitive to performance of record creation.

Q: Does a strategy for generating keys locally exist?

This strategy should work across databases where Cayenne does not
support server generated primary keys.

Getting a primary key by e.g.:

SELECT MAX(ID)+1 FROM FOO

This would a) be slow b) risk a collision when inserting.

Qs:

a) can I always override a server generated key?
b) would it be sufficient to use exception handling and retry e.g. N times?



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

Reply via email to