db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Fischer (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (TORQUE-23) DeepCopy
Date Wed, 31 May 2006 21:18:30 GMT
     [ http://issues.apache.org/jira/browse/TORQUE-23?page=all ]
Thomas Fischer resolved TORQUE-23:

    Fix Version: 3.2.1
     Resolution: Fixed
      Assign To: Thomas Fischer

Fixed in SVN.
Changed the attached patch in order to retain the old behaviour if complexObjectModel is false.
Added the missing parameter in call of copyInto()  in method copy(boolean)

> DeepCopy
> --------
>          Key: TORQUE-23
>          URL: http://issues.apache.org/jira/browse/TORQUE-23
>      Project: Torque
>         Type: New Feature

>   Components: Generator
>     Reporter: Thoralf Rickert
>     Assignee: Thomas Fischer
>     Priority: Minor
>      Fix For: 3.2.1
>  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:
For more information on JIRA, see:

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message