Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 75539 invoked from network); 24 May 2006 13:12:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 May 2006 13:12:57 -0000 Received: (qmail 43222 invoked by uid 500); 24 May 2006 13:12:57 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 43195 invoked by uid 500); 24 May 2006 13:12:56 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 43183 invoked by uid 99); 24 May 2006 13:12:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 06:12:56 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [62.109.81.242] (HELO mail.cadooz.de) (62.109.81.242) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 May 2006 06:12:55 -0700 Received: from [192.168.107.5] (helo=securemail.cadooz-ag.intern) by gateway.cadooz-ag.intern with esmtp (Exim 4.43) id 1FitAA-0000vX-7z for torque-dev@db.apache.org; Wed, 24 May 2006 15:12:34 +0200 Received: from securemail (localhost [127.0.0.1]) by securemail.cadooz-ag.intern (Postfix) with ESMTP id 31C2F6BC058 for ; Wed, 24 May 2006 15:12:34 +0200 (CEST) Received: from srv-master.cadooz-ag.intern (srv-master.cadooz-ag.intern [192.168.107.3]) by securemail.cadooz-ag.intern (Postfix) with ESMTP id 2BDE66BC057 for ; Wed, 24 May 2006 15:12:34 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Copying Torque Object X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 24 May 2006 15:12:34 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Copying Torque Object Thread-Index: AcZ/M7hRHNoq0pkVRhiaYjFco81Aig== From: "Thoralf Rickert" To: "Apache Torque Developers List" X-TBoneOriginalFrom: "Thoralf Rickert" X-TBoneOriginalTo: "Apache Torque Developers List" X-TBoneDomainSigned: false X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi! I've a small problem with the copy() and copyInto() methods in the generated Torque objects. I've tables with dependencies from other tables (for example a table "login" which has a foreign key to a table "address"). I want to use the BaseAddress.copy() method to copy the address object and save it. If I use this method, it also loads and copies internally all logins which are linked to the source address to the new address. So, it makes a deep copy. Is it possible, to override this behaviour outside the Base* class without creating a totally new copy() method? I don't think so... I've noticed this some time a go and wrote my own copy() method in the extended Address class like this: public Address copy(boolean deepcopy) throws Exception { if (deepcopy) return super.copy(); else { Address newAddress =3D new Address(); newAddress.setFirstname(firstname); .... return newAddress; } } But after a little while I've added a new column to the address table and forgot to update the new copy() method too. So I didn't copy all data, if I use copy(false) - which takes some time to find and fix. I can't make a deep copy because there could be many thousands of referer rows to an address. I just want to copy the address data. So, the best way would be, that this copy(boolean) method should be added during BaseAddress generation in that class. I think, it's not very complicated to add this "feature". Here is my proposal: 1. add in Object.vm a new boolean parameter to copy() like this public $table.JavaName copy(boolean deepcopy) throws TorqueException { return copyInto(new ${table.JavaName}(),deepcopy); } 2. create two new downwards compatible methods copy() and copyInto() public $table.JavaName copy() throws TorqueException { return copy(true); } protected $table.JavaName copyInto($table.JavaName copyObj) throws TorqueException { return copyInto(copyObject, true); } 3. add a new parameter deepcopy to the old copyInto() method and check that variable before making the deepcopy. I think, it's not necessary to submit that value recursivly to the referers. protected $table.JavaName copyInto($table.JavaName copyObj, boolean) throws TorqueException { .... #if ($complexObjectModel) if (deepcopy) { #foreach ($fk in $table.Referrers) ... #end } #end } Is that possible or did I forgot something important? bye Thoralf --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org