Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 45280 invoked from network); 26 Nov 2006 18:25:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Nov 2006 18:25:15 -0000 Received: (qmail 85666 invoked by uid 500); 26 Nov 2006 18:25:24 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 85640 invoked by uid 500); 26 Nov 2006 18:25:24 -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 85625 invoked by uid 99); 26 Nov 2006 18:25:24 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Nov 2006 10:25:24 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Nov 2006 10:25:14 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0F17D714325 for ; Sun, 26 Nov 2006 10:24:48 -0800 (PST) Message-ID: <11089565.1164565488059.JavaMail.jira@brutus> Date: Sun, 26 Nov 2006 10:24:48 -0800 (PST) From: "Thomas Vandahl (JIRA)" To: torque-dev@db.apache.org Subject: [jira] Closed: (TORQUE-23) DeepCopy In-Reply-To: <5715566.1148892809891.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/TORQUE-23?page=all ] Thomas Vandahl closed TORQUE-23. -------------------------------- > DeepCopy > -------- > > Key: TORQUE-23 > URL: http://issues.apache.org/jira/browse/TORQUE-23 > Project: Torque > Issue Type: New Feature > Components: Generator > Reporter: Thoralf Rickert > Assigned To: Thomas Fischer > Priority: Minor > Fix For: 3.3 > > Attachments: patch.txt > > > 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. > If the object "Address" has many hundreds related objects of "Login" this deep copy makes a lot that is sometimes not necessary. So, it's better to let the user/programmer decide if there program should do a deep copy or not. > The best way would be, that there is a copy(boolean) method that should be added during BaseAddress generation. 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 > } > Maybe I can create a patch for you. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org