You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Thoralf Rickert <th...@cadooz.de> on 2006/06/01 09:03:16 UTC

AW: [jira] Resolved: (TORQUE-23) DeepCopy

Thanks!


> -----Ursprüngliche Nachricht-----
> Von: Thomas Fischer (JIRA) [mailto:jira@apache.org] 
> Gesendet: Mittwoch, 31. Mai 2006 23:19
> An: torque-dev@db.apache.org
> Betreff: [jira] Resolved: (TORQUE-23) DeepCopy
> 
> 
>      [ 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:
>    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
> 
> 



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