Hi Fay, Thanks for the patch, that should work! But I am not able to try the patch as the ClassMapping.java in openjpa svn has already moved to a newer version. Any suggestion on how could I build/try the patch?
Thanks Gopal Fay Wang wrote: > > Yes, you are right. This problem is caused by a relation field being > annotated as a primary key and foreign key. You might want to apply the > patch I put in JIRA-679. Before the patch: > > CREATE TABLE D (id VARCHAR(254) NOT NULL, a VARCHAR(254), C_CID > VARCHAR(254), C_CM_CMID VARCHAR(254), C_CM_E_EID VARCHAR(254), PRIMARY KEY > (id)) > > After the patch: > CREATE TABLE D (id VARCHAR(254) NOT NULL, a VARCHAR(254), C_CID > VARCHAR(254), C_CM_CMID VARCHAR(254), C_CM_E_EID VARCHAR(254), VC_VCID > VARCHAR(254) NOT NULL, VC_VCS_E_EID VARCHAR(254) NOT NULL, VC_VCS_VCSID > VARCHAR(254) NOT NULL, PRIMARY KEY (id, VC_VCID, VC_VCS_E_EID, > VC_VCS_VCSID)) > > > > --- On Fri, 8/8/08, Gopalakrishnan U <[EMAIL PROTECTED]> wrote: > >> From: Gopalakrishnan U <[EMAIL PROTECTED]> >> Subject: Re: ArrayIndexOutOfBoundsException:0 at >> org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL(DBDictionary.java:3373) >> To: [email protected] >> Date: Friday, August 8, 2008, 2:01 AM >> The SQL generated for creating OPENJPASAMPLE.D table is >> wrong. Here is the >> SQL generated for creating the D table CREATE TABLE >> OPENJPASAMPLE.D (id >> INTEGER NOT NULL, C_CID INTEGER, C_CM_CMID INTEGER, >> C_CM_E_EID INTEGER, >> PRIMARY KEY (id)). It is missing fields from VC --< D >> relation and >> corresponding PKs >> I think this is causing the problem when it is trying to >> generate the SQL >> for creating FK for the OPENJPASAMPLE.D table. >> >> Opened a JIRA for this issue >> https://issues.apache.org/jira/browse/OPENJPA-682. >> >> Gopal >> -- >> View this message in context: >> http://n2.nabble.com/ArrayIndexOutOfBoundsException%3A0-at-org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL%28DBDictionary.java%3A3373%29-tp668199p680224.html >> Sent from the OpenJPA Users mailing list archive at >> Nabble.com. > > > > > -- View this message in context: http://n2.nabble.com/ArrayIndexOutOfBoundsException%3A0-at-org.apache.openjpa.jdbc.sql.DBDictionary.getForeignKeyConstraintSQL%28DBDictionary.java%3A3373%29-tp668199p687273.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
