Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 82820 invoked from network); 17 Feb 2006 10:01:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Feb 2006 10:01:33 -0000 Received: (qmail 92002 invoked by uid 500); 17 Feb 2006 10:01:31 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 91990 invoked by uid 500); 17 Feb 2006 10:01:31 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 91979 invoked by uid 99); 17 Feb 2006 10:01:30 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2006 02:01:30 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [83.103.39.74] (HELO localhost.localdomain) (83.103.39.74) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2006 02:01:29 -0800 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 7AF01485C0 for ; Fri, 17 Feb 2006 11:05:16 +0100 (CET) Message-ID: <43F59FDC.2050407@ste-energy.com> Date: Fri, 17 Feb 2006 11:05:16 +0100 From: Matteo Barbieri Organization: S.T.E. s.r.l. User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: Apache Torque Users List Subject: Saving two related objects X-Enigmail-Version: 0.92.1.0 OpenPGP: id=3890B783 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, maybe it's a stupid question, but I got an error that I don't know why it happens. I have two tables that are related by foreign key. I have to create one istance of both objects and to save them. I do something like this: FirstClass first = new FirstClass(); SecondClass second = new SecondClass(); first.save(); second.setFirstClass(first); second.save(); the first object is saved correctly, but then I got an SQLException: java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails I've tried to print both objects before every saving and the second object has the correct foreign key. Any idea? Thanks -- Matteo Barbieri S.T.E. s.r.l. m.barbieri@ste-energy.com --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org