db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Youngho Cho" <youn...@nannet.co.kr>
Subject [Patch] During save a object , relative object call reset all relative object which should be saving.
Date Mon, 17 Apr 2006 00:41:46 GMT
Hello,
For some case, I need a relative object call during run save method.
In that case, if criteria is different, the $collName is reset.
than $collName can not completely finish.

Here is a patch for that case.


Index: templates/trunk/src/templates/om/Object.vm
===================================================================
--- templates/trunk/src/templates/om/Object.vm  (revision 394586)
+++ templates/trunk/src/templates/om/Object.vm  (working copy)
@@ -1315,9 +1315,10 @@
         #if ($objectIsCaching)
             if ($collName != null)
             {
-                for (int i = 0; i < ${collName}.size(); i++)
+                final List list = new ArrayList($collName);
+                for (int i = 0; i < list.size(); i++)
                 {
-                    ((${className}) ${collName}.get(i)).save(con);
+                    ((${className}) list.get(i)).save(con);
                 }
             }
         #end

Index: templates/trunk/src/templates/om/ObjectWithManager.vm
===================================================================
--- templates/trunk/src/templates/om/ObjectWithManager.vm       (revision 394586)
+++ templates/trunk/src/templates/om/ObjectWithManager.vm       (working copy)
@@ -1322,9 +1322,10 @@
         #if ($objectIsCaching)
             if ($collName != null)
             {
-                for (int i = 0; i < ${collName}.size(); i++)
+                final List list = new ArrayList($collName);
+                for (int i = 0; i < list.size(); i++)
                 {
-                    ((${className}) ${collName}.get(i)).save(con);
+                    ((${className}) list.get(i)).save(con);
                 }
             }
         #end


Thanks,

Youngho
Mime
View raw message