db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Vandahl (JIRA)" <j...@apache.org>
Subject [jira] Closed: (TORQUE-23) DeepCopy
Date Sun, 26 Nov 2006 18:24:48 GMT
     [ 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

View raw message