From dev-return-19650-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Nov 4 21:34:16 2011 Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 57B7D9D36 for ; Fri, 4 Nov 2011 21:34:16 +0000 (UTC) Received: (qmail 43415 invoked by uid 500); 4 Nov 2011 21:34:16 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 43346 invoked by uid 500); 4 Nov 2011 21:34:15 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 43275 invoked by uid 99); 4 Nov 2011 21:34:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 21:34:15 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2011 21:34:12 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id E5FCC30C4F3 for ; Fri, 4 Nov 2011 21:33:51 +0000 (UTC) Date: Fri, 4 Nov 2011 21:33:51 +0000 (UTC) From: "Albert Lee (Created) (JIRA)" To: dev@openjpa.apache.org Message-ID: <227160632.1279.1320442431943.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (OPENJPA-2069) Natvie sequence problems uncovered after OPENJPA-1376 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org Natvie sequence problems uncovered after OPENJPA-1376 ----------------------------------------------------- Key: OPENJPA-2069 URL: https://issues.apache.org/jira/browse/OPENJPA-2069 Project: OpenJPA Issue Type: Bug Components: jdbc, kernel Affects Versions: 2.1.2, 2.2.0 Reporter: Albert Lee After OPENJPA-1376 commits, it uncovered a few issues, some old and some new. 1. Backward compatibility - Previous, openjpa relies on the native sequence to provide the next value based on the sequence's INCREMENT BY setting. Now that openjpa manages the next sequence value and allocation size, if the db sequence is manually created that does not match the application's increment and allocation size, committing a new entity may result a constraint violation exception when new sequence value is requested that crossed the allocation boundary. This behavior is indirectly documented in the migration consideration section in the user manual, but it would be better if this can be handled automatically or at least to provide a compatibility option to honor previous behavior. 2. Initial value always start with the same value (default to 1) - In NativeJDBCSeq, the _initial, _increment and _allocate are used for the CREATE SEQUENCE generation for SynchronizeMapping function. For existing db sequence, next returns whatever managed by the db sequence. After the commit, next will first return the_nextValue value in NativeJDBCSeq until _maxValue is reached, then it go to db to get the sequence's next value, which may be ways off from the current _maxValue. 3. _nextValue not handled proper when crossing _allocate boundary - When NativeJDBCSeq's _nextValue exceeds the _maxValue boundary, it queries db's sequence for the next incremental value and assign directly as the next return value. It works for incrementBy = 1 but for some value (e.g. 3), the difference of the before and after cross boundary values may NOT be the _increment value. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira