Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 7194 invoked from network); 6 Nov 2003 12:59:56 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Nov 2003 12:59:56 -0000 Received: (qmail 83687 invoked by uid 500); 6 Nov 2003 12:59:53 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 83664 invoked by uid 500); 6 Nov 2003 12:59:53 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 83643 invoked from network); 6 Nov 2003 12:59:52 -0000 Received: from unknown (HELO smtp4.jaring.my) (61.6.32.54) by daedalus.apache.org with SMTP; 6 Nov 2003 12:59:52 -0000 Received: from PSSBDEV1 ([219.94.58.82]) (authenticated bits=0) by smtp4.jaring.my (8.12.10/8.12.9) with ESMTP id hA6Cxlmu068400; Thu, 6 Nov 2003 20:59:51 +0800 (MYT) (envelope-from ywchiu@paradigm.com.my) From: "Chiu Yee Weay" To: "'Apache Torque Users List'" Cc: Subject: RE: Problem with jdbc 2 XML Date: Thu, 6 Nov 2003 20:59:42 +0800 Organization: Paradigm Systems Sdn Bhd Message-ID: <004001c3a465$dbe02d60$c900007e@PSSBDEV1> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal In-Reply-To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Greetings, I do not know how's mysql's behavior, but looking at the source file, this might be caused by the following conditions : - foreign keys' name is not null - same foreign keys' name for different foreign tables So, instead of using the foreign key name, I would recommend using the foreign table name instead. Here's my refined getForeignKeys method in TorqueJDBCTransformTask.java : /** * Retrieves a list of foreign key columns for a given table. * * @param dbMeta JDBC metadata. * @param tableName Table from which to retrieve FK information. * @return A list of foreign keys in tableName. * @throws SQLException */ public Collection getForeignKeys(DatabaseMetaData dbMeta, String tableName) throws SQLException { Hashtable fks = new Hashtable(); ResultSet foreignKeys = null; try { foreignKeys = dbMeta.getImportedKeys(null, dbSchema, tableName); while (foreignKeys.next()) { String refTableName = foreignKeys.getString(3); //referenced table name String refColumnName = foreignKeys.getString(4); //foreign column String localColumnName = foreignKeys.getString(8); //local column Object[] fk = (Object[]) fks.get(refTableName); List refs; if (fk == null) { fk = new Object[2]; fk[0] = refTableName; refs = new ArrayList(); } else { refs = (ArrayList) fk[1]; } String[] ref = new String[2]; ref[0] = localColumnName; ref[1] = refColumnName; refs.add(ref); fk[1] = refs; fks.put(refTableName, fk); } } finally { if (foreignKeys != null) { foreignKeys.close(); } } return fks.values(); } Thanks. Chiu Yee Weay Systems Engineer Paradigm Systems Sdn Bhd -----Original Message----- From: Amine Bousta [mailto:abousta@lxsolutions.com] Sent: Thursday, November 06, 2003 12:34 AM To: Apache Torque Users List Subject: Problem with jdbc 2 XML Hello, I'm experiencing a lot of problems by trying to generate an xml schema from a sql file. The last one is : I'm using Mysql with InnoDB tables and foreign keys. I'm trying to launch ant on build-torque.xml with the "jdbc" option. When a table A has a foreign key into a table B and another into table C, it generates : instead of : as expected. If anybody knows a workaround I'd really appreciate :) Thank you Amine PS : Is this the good place here to report Torque bugs or do I have to post them in a bug database? --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org [ Scanned by JARING E-Mail Virus Scanner ( http://www.jaring.my ) ] --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org