You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2014/12/23 08:25:13 UTC

[jira] [Commented] (CAY-1982) Mismatched Sequence Cache for Database Sequence Generated Keys

    [ https://issues.apache.org/jira/browse/CAY-1982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14256699#comment-14256699 ] 

Andrus Adamchik commented on CAY-1982:
--------------------------------------

So this is essentially a mapping mismatch that can be corrected by the user in the Modeler. This can be confusing to be sure. 

Still in a case when one generates their schema from Cayenne model, the right increment amount will be set. Alternatively if a sequence was already in the DB and is not related to Cayenne, it has to be mapped explicitly, as it is likely not following our naming convention, and in this case setting "Cached PK Size" doesn't create any extra effort. 

Did I overlook something?



> Mismatched Sequence Cache for Database Sequence Generated Keys
> --------------------------------------------------------------
>
>                 Key: CAY-1982
>                 URL: https://issues.apache.org/jira/browse/CAY-1982
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.1
>            Reporter: Andrew Lindesay
>             Fix For: 4.0.M2
>
>
> I've seen this myself, but it was also raised on the mailing list today.  The system has a sequence with an "increment_by" value of 1.  This generates an increment of 1 for each query to get the next value.
> Cayenne on the other hand has a default cache of 20 defined at JdbcPkGenerator#DEFAULT_PK_CACHE_SIZE.  This creates a problem because Cayenne assigns PK's 1..20 for its use, but the sequence is only incremented by 1 in the database.
> Maybe look at generating corrected DDL or defaulting to a cache of 1 for the case where primary keys are being database generated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)