You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2013/06/24 19:06:20 UTC

[jira] [Commented] (OPENJPA-2390) HSQLDB SELECT NEXT VALUE FOR Sequence will skip 1 sequence value if allocation size is 1

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

ASF subversion and git services commented on OPENJPA-2390:
----------------------------------------------------------

Commit 1496124 from allee8285@apache.org
[ https://svn.apache.org/r1496124 ]

OPENJPA-2390 - commit patch contributed by Di Lau.
                
> HSQLDB SELECT NEXT VALUE FOR Sequence will skip 1 sequence value if allocation size is 1
> ----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2390
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2390
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.1
>            Reporter: René Link
>            Assignee: Albert Lee
>             Fix For: 2.3.0
>
>         Attachments: HSQLSequenceTest.java, OPENJPA-2390.patch
>
>
> The HSQLDictionary sets the DBDictionary.nextSequenceQuery to "SELECT NEXT VALUE FOR {0} FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES" when the HSQLDictionary is initialized.
> The NativeJDBCSeq uses
>  _select = MessageFormat.format(format, new Object[]{name, String.valueOf(_allocate * _increment)});
> to build the select next value sql. The format is pased 2 arguments "name" and "_allocate * _increment"
> but the second is not honored by the nextSequenceQuery.
> So when the allocation size is set to 1 the hsqldb nextSequenceQuery statement will return 2 next values
> anyway. That is why always one next value will be skipped... 1, 3, 5, 7, and so on.
> The nextSequenceQuery should be set with an limit. E.g.
> "SELECT NEXT VALUE FOR {0} FROM INFORMATION_SCHEMA.SYSTEM_SEQUENCES LIMIT {1}"
> I will attatch an unit test that uses in memory hsqldb to show the problem soon.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira