From dev-return-21243-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Fri Nov 9 10:38:16 2012 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 31BB9D8C9 for ; Fri, 9 Nov 2012 10:38:16 +0000 (UTC) Received: (qmail 85888 invoked by uid 500); 9 Nov 2012 10:38:13 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 85791 invoked by uid 500); 9 Nov 2012 10:38:13 -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 85745 invoked by uid 99); 9 Nov 2012 10:38:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 10:38:12 +0000 Date: Fri, 9 Nov 2012 10:38:12 +0000 (UTC) From: =?utf-8?Q?S=C3=A9bastien_Dante_Ursini_=28JIRA=29?= To: dev@openjpa.apache.org Message-ID: <155035063.91176.1352457492770.JavaMail.jiratomcat@arcas> In-Reply-To: <826137479.91174.1352457492478.JavaMail.jiratomcat@arcas> Subject: [jira] [Updated] (OPENJPA-2297) Unable to determine which sequences are owned by the database (Postgresl dictionnary) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2297?page=3Dcom.atlass= ian.jira.plugin.system.issuetabpanels:all-tabpanel ] S=C3=A9bastien Dante Ursini updated OPENJPA-2297: -------------------------------------------- Description:=20 Error :=20 Unable to determine which sequences are owned by the database. OpenJPA will= consider all sequences suffixed with "_seq" as database managed. =20 This may result in im proper creation or removal of sequences with this suf= fix. The original PostgreSQL driver exception is being logged for your refe= rence. ... SELECT pg_get_serial_sequence(?, ?) ... The problem is related to the use of the underscore in table name. Let's im= agine you have an entity called SubscriptionEvent with an auto generated fi= eld called id (GenerationType.IDENTITY). You want OpenJPA to create a table named SUBSCRIPTION_EVENT by using the fo= llowing annotation to please you DBA with is favorite naming convention : @Table(name=3D"SUBSCRIPTION_EVENT")=20 The problem occurs when the class PostgresDictionary try to determine wheth= er a sequence is owned by the database using the method is isOwnedSequence.= This method use another method called buildNames to define what is the tab= le name and the column name to provide the parameters to the sql statement = : SELECT pg_get_serial_sequence(?, ?)=20 The argument provided to buildNames according to the name provided in the a= nnotation @Table and the identity field is : "subscription_event_id". Build= Names split this string using the underscore as separator interpreting this= :=20 Table name :=09 subscription Column name :=09 event_id instead of=20 Table name :=09 subscription_event Column name :=09 id As a workaround you have to remove the underscore in you table or field nam= e. But it is in my opinion a bug to rely on the underscore to split the tab= le from the column name. was: Error :=20 Unable to determine which sequences are owned by the database. OpenJPA will= consider all sequences suffixed with "_seq" as database managed. =20 This may result in im proper creation or removal of sequences with this suf= fix. The original PostgreSQL driver exception is being logged for your refe= rence. ... SELECT pg_get_serial_sequence(?, ?) ... The problem is related to the use of the underscore in table name. Let's im= agine you have an entity called SubscriptionEvent with an auto generated fi= eld called id (GenerationType.IDENTITY). You want OpenJPA to create a table named SUBSCRIPTION_EVENT by using the fo= llowing annotation to please you DBA with is favorite naming convention : @Table(name=3D"SUBSCRIPTION_EVENT")=20 The problem occurs when the class PostgresDictionary try to determine wheth= er a sequence is owned by the database using the method is isOwnedSequence.= This method use another method called buildNames to define what is the tab= le name and the column name to provide the parameters to the sql statement = : SELECT pg_get_serial_sequence(?, ?)=20 The argument provided to buildNames according to the name provided in the a= nnotation @Table and the identity field is : "subscription_event_id". Build= Names split this string using the underscore as separator interpreting this= :=20 Table name :=09 subscription Column name :=09 event_id instead of=20 Table name :=09 subscription_event Column name :=09 id As a workaround you have to remove the underscore in you table or field nam= e. But it is in my opinion a bug to rely on the underscore to split the tab= le from the column name. =20 > Unable to determine which sequences are owned by the database (Postgresl = dictionnary) > -------------------------------------------------------------------------= ------------ > > Key: OPENJPA-2297 > URL: https://issues.apache.org/jira/browse/OPENJPA-2297 > Project: OpenJPA > Issue Type: Bug > Components: jpa > Affects Versions: 2.1.1 > Environment: OS : Windows Application : Apache Geronimo 3.0 Data > Reporter: S=C3=A9bastien Dante Ursini > > Error :=20 > Unable to determine which sequences are owned by the database. OpenJPA wi= ll consider all sequences suffixed with "_seq" as database managed. =20 > This may result in im proper creation or removal of sequences with this s= uffix. The original PostgreSQL driver exception is being logged for your re= ference. > ... > SELECT pg_get_serial_sequence(?, ?) > ... > The problem is related to the use of the underscore in table name. Let's = imagine you have an entity called SubscriptionEvent with an auto generated = field called id (GenerationType.IDENTITY). > You want OpenJPA to create a table named SUBSCRIPTION_EVENT by using the = following annotation to please you DBA with is favorite naming convention : > @Table(name=3D"SUBSCRIPTION_EVENT")=20 > The problem occurs when the class PostgresDictionary try to determine whe= ther a sequence is owned by the database using the method is isOwnedSequenc= e. This method use another method called buildNames to define what is the t= able name and the column name to provide the parameters to the sql statemen= t : > SELECT pg_get_serial_sequence(?, ?)=20 > The argument provided to buildNames according to the name provided in the= annotation @Table and the identity field is : "subscription_event_id". Bui= ldNames split this string using the underscore as separator interpreting th= is :=20 > Table name :=09 subscription > Column name :=09 event_id > instead of=20 > Table name :=09 subscription_event > Column name :=09 id > As a workaround you have to remove the underscore in you table or field n= ame. But it is in my opinion a bug to rely on the underscore to split the t= able from the column name. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira