jmcnally 02/02/26 22:15:42
Modified: src/templates/om Object.vm
Log:
do not remove an associated object if the value of the new id is the same
as the id of the current object. This happens for example when the associated
object is new and calling its save method causes this foreign key id to be
updated to account for the id change of the associated object.
Revision Changes Path
1.19 +23 -18 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Object.vm 27 Dec 2001 18:28:59 -0000 1.18
+++ Object.vm 27 Feb 2002 06:15:42 -0000 1.19
@@ -132,6 +132,25 @@
}
#end
+
+#if ($addSaveMethod)
+
+ #if ( ($cjtype == "int") || ($cjtype == "long") || ($cjtype == "boolean")
+ || ($cjtype == "short") || ($cjtype == "float") || ($cjtype == "double")
+ || ($cjtype == "char") || ($cjtype == "byte") )
+ if (this.$clo != v)
+ {
+ #else
+ if ( !ObjectUtils.equals(this.$clo, v) )
+ {
+ #end
+ this.$clo = v;
+ setModified(true);
+ }
+#else
+ this.$clo = v;
+#end
+
#if ($complexObjectModel)
#if ($col.isForeignKey())
#set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
@@ -141,7 +160,11 @@
#else
#set ( $varName = "a$tblFK.JavaName" )
#end
+
+ if ($varName != null &&
!ObjectUtils.equals(${varName}.get${colFK.JavaName}(), v) )
+ {
$varName = null;
+ }
#end
#foreach ($fk in $col.Referrers)
@@ -167,24 +190,6 @@
#end
#end
#end
-
-#if ($addSaveMethod)
-
- #if ( ($cjtype == "int") || ($cjtype == "long") || ($cjtype == "boolean")
- || ($cjtype == "short") || ($cjtype == "float") || ($cjtype == "double")
- || ($cjtype == "char") || ($cjtype == "byte") )
- if (this.$clo != v)
- {
- #else
- if ( !ObjectUtils.equals(this.$clo, v) )
- {
- #end
- this.$clo = v;
- setModified(true);
- }
-#else
- this.$clo = v;
-#end
}
##if ($complexObjectModel)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>