Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 64483 invoked from network); 16 Aug 2010 21:32:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Aug 2010 21:32:41 -0000 Received: (qmail 17882 invoked by uid 500); 16 Aug 2010 21:32:41 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 17736 invoked by uid 500); 16 Aug 2010 21:32:40 -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 17728 invoked by uid 99); 16 Aug 2010 21:32:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Aug 2010 21:32:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Aug 2010 21:32:40 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o7GLWJ0V021460 for ; Mon, 16 Aug 2010 21:32:19 GMT Message-ID: <28404378.376961281994339718.JavaMail.jira@thor> Date: Mon, 16 Aug 2010 17:32:19 -0400 (EDT) From: "Donald Woods (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-1066) Generated ID starting with 0 can cause unexpected results In-Reply-To: <598781182.1241614832602.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Donald Woods updated OPENJPA-1066: ---------------------------------- Fix Version/s: 2.0.2 2.1.0 (was: 2.0.1) > Generated ID starting with 0 can cause unexpected results > --------------------------------------------------------- > > Key: OPENJPA-1066 > URL: https://issues.apache.org/jira/browse/OPENJPA-1066 > Project: OpenJPA > Issue Type: Improvement > Components: kernel > Affects Versions: 2.0.0-M2 > Environment: any DB that allows a generated id to start with 0. And an entity that maps that generated id to an int instead of an Integer > Reporter: B.J. Reed > Priority: Minor > Fix For: 2.0.2, 2.1.0 > > Attachments: GeneratedIDStartsWith0.ZIP > > > Several DB's allow a generated id column to start with 0. > For instance, DB2 allows "GENERATED ALWAYS AS IDENTITY (START WITH 0)...." > When this is used, the very first object will have an id of 0. When entities are first created, the user usually won't fill in the corresponding id field (since it will be generated by the DB when the entity is put in the DB), so it defaults to 0. The entity manager then uses this 0 and sees that an entity already exists and will update the old entity in stead of creating a new one. > This is not a large issue, because a user could simply specify "START WITH 1" as a very simple workaround or they could use an Integer instead of an int, but it would be nice to fix so that new users don't hit this problem. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.