Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 50708 invoked from network); 8 Aug 2008 07:37:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Aug 2008 07:37:12 -0000 Received: (qmail 92033 invoked by uid 500); 8 Aug 2008 07:37:11 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 92006 invoked by uid 500); 8 Aug 2008 07:37:11 -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 91995 invoked by uid 99); 8 Aug 2008 07:37:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 00:37:11 -0700 X-ASF-Spam-Status: No, hits=-1999.8 required=10.0 tests=ALL_TRUSTED,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 07:36:16 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6B1CA234C190 for ; Fri, 8 Aug 2008 00:36:44 -0700 (PDT) Message-ID: <1574379655.1218181004423.JavaMail.jira@brutus> Date: Fri, 8 Aug 2008 00:36:44 -0700 (PDT) From: "Gopalakrishnan (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-682) java.lang.ArrayIndexOutOfBoundsException: 0 at at org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL() when creatingEntitymanager MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org java.lang.ArrayIndexOutOfBoundsException: 0 at at org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL() when creatingEntitymanager -------------------------------------------------------------------------------------------------------------------------------------------------- Key: OPENJPA-682 URL: https://issues.apache.org/jira/browse/OPENJPA-682 Project: OpenJPA Issue Type: Bug Affects Versions: 1.2.0 Environment: OpenJPA 1.2.0 SNAPSHOT (July 25th build), Derby 10.4.1.13, Reporter: Gopalakrishnan EntityManagerFactory.createEntityManager() throws java.lang.ArrayIndexOutOfBoundsException: 0 for the sample application attached. Here is the complete trace. org.apache.openjpa.persistence.PersistenceException: 0 at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196) at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145) at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56) at jpatest.test.JPATest.setUp(JPATest.java:41) ... Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL(DBDictionary.java:3373) at org.apache.openjpa.jdbc.sql.DBDictionary.getAddForeignKeySQL(DBDictionary.java:3252) at org.apache.openjpa.jdbc.schema.SchemaTool.addForeignKey(SchemaTool.java:1066) at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:604) at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344) at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501) at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:453) at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159) at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119) at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:189) ... 29 more I enabled SQLtrace and the SQL generated for OPENJPASAMPLE.D is missing fields from its relation to VC. I am expecting create table D command to be CREATE TABLE OPENJPASAMPLE.D (id INTEGER NOT NULL, VC_VCID INTEGER, VC_VCS_VCSID INTEGER, VC_VCS_E_EID INTEGER, C_CID INTEGER, C_CM_CMID INTEGER, C_CM_E_EID INTEGER, PRIMARY KEY (id,VC_VCID INTEGER, VC_VCS_VCSID INTEGER, VC_VCS_E_EID INTEGER)) Given below is the SQLTrace: 8015 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 31447311 CREATE TABLE OPENJPASAMPLE.C (cId INTEGER NOT NULL, CM_CMID INTEGER NOT NULL, CM_E_EID INTEGER NOT NULL, PRIMARY KEY (cId, CM_CMID, CM_E_EID)) 8187 test TRACE [main] openjpa.jdbc.SQL - [172 ms] spent 8187 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 29499086 CREATE TABLE OPENJPASAMPLE.CM (cmId INTEGER NOT NULL, E_EID INTEGER NOT NULL, PRIMARY KEY (cmId, E_EID)) 8343 test TRACE [main] openjpa.jdbc.SQL - [156 ms] spent 8359 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 2011334 CREATE TABLE OPENJPASAMPLE.D (id INTEGER NOT NULL, C_CID INTEGER, C_CM_CMID INTEGER, C_CM_E_EID INTEGER, PRIMARY KEY (id)) 8484 test TRACE [main] openjpa.jdbc.SQL - [125 ms] spent 8500 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 22823147 CREATE TABLE OPENJPASAMPLE.E (eId INTEGER NOT NULL, PRIMARY KEY (eId)) 8750 test TRACE [main] openjpa.jdbc.SQL - [250 ms] spent 8750 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 21731956 CREATE TABLE OPENJPASAMPLE.VC (vcId INTEGER NOT NULL, VCS_E_EID INTEGER NOT NULL, VCS_VCSID INTEGER NOT NULL, PRIMARY KEY (vcId, VCS_E_EID, VCS_VCSID)) 8890 test TRACE [main] openjpa.jdbc.SQL - [140 ms] spent 8906 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 7202313 CREATE TABLE OPENJPASAMPLE.VCS (E_EID INTEGER NOT NULL, vcsId INTEGER NOT NULL, PRIMARY KEY (E_EID, vcsId)) 9047 test TRACE [main] openjpa.jdbc.SQL - [141 ms] spent 9047 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 10023314 ALTER TABLE OPENJPASAMPLE.C ADD FOREIGN KEY (CM_CMID, CM_E_EID) REFERENCES OPENJPASAMPLE.CM (cmId, E_EID) 9156 test TRACE [main] openjpa.jdbc.SQL - [109 ms] spent 9156 test TRACE [main] openjpa.jdbc.SQL - executing stmnt 24685281 ALTER TABLE OPENJPASAMPLE.CM ADD FOREIGN KEY (E_EID) REFERENCES OPENJPASAMPLE.E (eId) 9250 test TRACE [main] openjpa.jdbc.SQL - [94 ms] spent org.apache.openjpa.persistence.PersistenceException: 0 at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196) So I am assuming that it is failing at generation of foreign key command for OPENJPASAMPLE.D table. When the classes C and CM are renamed to WC and WCM (i.e alphabetically higher than VC and VCS) the problem goes away. Here is link to post regarding this problem in the OpenJPA user list : http://n2.nabble.com/ArrayIndexOutOfBoundsException%3A0-at-org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL%28DBDictionary.java%3A3373%29-td668199.html -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.