On Apr 22, 2006, at 3:50 PM, Mike Kienenberger wrote:

On 4/22/06, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
An implementation of a smarter auto PK configuration mechanism has
been pending for some time, but I think this particular issue can be
addresses separately. You can try it on a custom PK generator and I
appreciate if you log this issue in Jira. Here is how the solution
might look like:

1. Override JdbcPkGenerator.createAutoPk(DataNode node, List
dbEntities) as follows -
2. Do a select from AUTO_PK_SUPPORT to check which entities are
already present in the DB
3. Subtract those entities from dbEntities list, getting a subset of
entities whose records are missing
4. This line "runUpdate(node, pkDeleteString(dbEntities))" should
only use a subset obtained in (3)

Another possible improvement might be to call "select max(<primary key
column>) from table" and using the larger of 200 or the returned value
+ 1 as the starting point.

You are right. I found the Jira issue that describes a similar request - it is no more complex than what I suggested above.

http://issues.apache.org/cayenne/browse/CAY-401

Andrus

Reply via email to