From dev-return-6488-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed Oct 17 21:23:12 2007 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 97243 invoked from network); 17 Oct 2007 21:23:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2007 21:23:12 -0000 Received: (qmail 69679 invoked by uid 500); 17 Oct 2007 20:58:59 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 69653 invoked by uid 500); 17 Oct 2007 20:58:59 -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 69643 invoked by uid 99); 17 Oct 2007 20:58:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 13:58:59 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 20:59:10 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9D6587141FE for ; Wed, 17 Oct 2007 13:58:50 -0700 (PDT) Message-ID: <16970091.1192654730625.JavaMail.jira@brutus> Date: Wed, 17 Oct 2007 13:58:50 -0700 (PDT) From: "Teresa Kan (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-399) openjpa did not handle multiple schema names with same table name In-Reply-To: <24244429.1192056530547.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Teresa Kan updated OPENJPA-399: ------------------------------- Attachment: OPENJPA-399_2.patch There was another problem occurred in SQLServer that the dict.getColumns() can't find the table names because openjpa alway convert the table name to upper case. The table name is case sensive on SQLServer, therefore, no tables are found. Openjpa created the tables again and failed with duplicate tables. The fix will introduce a getSchemaCase() method on DBDictionary. SQLServerDictionary overrides this method to return the SCHEMA_CASE_PERSERVE. Original code in DBDictionary on the convertSchemaCase : protected String convertSchemaCase(String objectName) { if (objectName == null) return null; if (SCHEMA_CASE_LOWER.equals(schemaCase)) return objectName.toLowerCase(); if (SCHEMA_CASE_PRESERVE.equals(schemaCase)) return objectName; return objectName.toUpperCase(); } Fix will be : protected String convertSchemaCase(String objectName) { if (objectName == null) return null; String scase = getSchemaCase(); if (SCHEMA_CASE_LOWER.equals(scase)) return objectName.toLowerCase(); if (SCHEMA_CASE_PRESERVE.equals(scase)) return objectName; return objectName.toUpperCase(); } > openjpa did not handle multiple schema names with same table name > ----------------------------------------------------------------- > > Key: OPENJPA-399 > URL: https://issues.apache.org/jira/browse/OPENJPA-399 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 1.0.1 > Environment: JDK1.5, OPENJPA verison 580425 > Reporter: Teresa Kan > Assignee: Teresa Kan > Attachments: OPENJPA-399_2.patch, OPENJPA_399.patch > > > Two entities have the same table name but with different schema, only one table is created. In addition, when two entities use the generatedType.AUTO for ID, only one OPENJPA_SEQUENCE-TABLE is created. > The problem due to the SchemaGroup.findTable() which only looked for a table name from all the schemas. Once the table was found in one of the schema then it exited and assumed that the table existed. Same problem in the TableJDBCSeq.addSchema(). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.