You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2001/12/27 18:18:14 UTC

cvs commit: jakarta-turbine-torque/src/templates/om Object.vm

jmcnally    01/12/27 09:18:14

  Modified:    src/templates/om Object.vm
  Log:
  patch by Nick Pomfret, modified by me, so that it produces compilable code.
  
  The copy() method in the torque generated in the object model doesn't seem
  to work as I would expect.
  
  When using the copy() method on an object it correctly copies that object
  but not those objects dependent upon it.  Looking at the automatically
  generated code it would appear that copying dependent objects is what is
  supposed to happen.
  
  Revision  Changes    Path
  1.17      +9 -5      jakarta-turbine-torque/src/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Object.vm,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Object.vm	2001/11/13 01:17:37	1.16
  +++ Object.vm	2001/12/27 17:18:14	1.17
  @@ -1130,15 +1130,19 @@
   
           #if ($relCol == "")
               #set ( $pCollName = "${className}s" )
  +            #set ( $pCollNameNoS = "${className}" )
           #else
               #set ( $pCollName = "${className}sRelatedBy$relCol" )
  +            #set ( $pCollNameNoS = "${className}RelatedBy$relCol" )
           #end
   
  -         ${list}v = copyObj.get${pCollName}();
  -         for (int i=0; i<v.size(); i++)
  -         {
  -             ((Persistent)v.get(i)).setNew(true);
  -         }
  +        ${list}v = get${pCollName}();
  +        for (int i=0; i<v.size(); i++)
  +        {
  +            $className obj = ($className) v.get(i);
  +            copyObj.add$pCollNameNoS(obj.copy());
  +            ((Persistent)v.get(i)).setNew(true);
  +        }
           #set ( $list = "" )
       #end
     #end
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>