Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 19150 invoked from network); 3 May 2009 12:00:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 May 2009 12:00:25 -0000 Received: (qmail 84918 invoked by uid 500); 3 May 2009 12:00:25 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 84828 invoked by uid 500); 3 May 2009 12:00:24 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 84818 invoked by uid 99); 3 May 2009 12:00:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 May 2009 12:00:24 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists+1214986160035-208411@n2.nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 May 2009 12:00:15 +0000 Received: from tervel.nabble.com ([192.168.236.150]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1M0aMM-0005vw-8q for users@openjpa.apache.org; Sun, 03 May 2009 04:59:54 -0700 Message-ID: <1241351994267-2777383.post@n2.nabble.com> Date: Sun, 3 May 2009 04:59:54 -0700 (PDT) From: Martin Dirichs To: users@openjpa.apache.org Subject: Re: Composite foreign keys with MySQL In-Reply-To: <1241300671558-2772619.post@n2.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nabble@dirichs.fastmail.fm References: <1241294764297-2772257.post@n2.nabble.com> <1241300671558-2772619.post@n2.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Yes, and there is no mention of this particular issue. -Martin. Rick Curtis wrote: > > Here are the known MySQL issues -- > http://openjpa.apache.org/builds/latest/docs/manual/manual.html#dbsupport_mysql_issues. > > -Rick > > > Martin Dirichs wrote: >> >> Hi, >> >> wondering why OpenJPA's MappingTool refused to add a foreign key >> constraint to the database (error message: openjpa.jdbc.Schema - The >> foreign key "" was not added to table "[...]"), I discovered >> that composite foreign key support is explicitly disabled for MySQL. >> These are the relevant code lines in >> org.apache.openjpa.jdbc.sql.MySQLDictionary: >> >> protected String getForeignKeyConstraintSQL(ForeignKey fk) { >> // mysql does not support composite foreign keys >> if (fk.getColumns().length > 1) >> return null; >> return super.getForeignKeyConstraintSQL(fk); >> } >> >> For all I know, composite foreign keys are possible with MySQL. At least, >> a statement like >> >> ALTER TABLE detail ADD CONSTRAINT constraint_x FOREIGN KEY (masterId1, >> masterId2) REFERENCES master (masterId1, masterId2); >> >> works perfectly well. Are there other deficits with MySQL foreign key >> handling I am not aware of or are the above lines in MySQLDictionary.java >> outdated / wrong? >> >> Regards, >> Martin. >> >> > > -- View this message in context: http://n2.nabble.com/Composite-foreign-keys-with-MySQL-tp2772257p2777383.html Sent from the OpenJPA Users mailing list archive at Nabble.com.