John,
What is the rationale behind disallowing setting of a foreign key when
an associated object has been retrieved? Sometimes even after retrieving
the associated object by object, I'd then like to set a new association
by ID rather than by retrieving the object with that ID and doing it
that way.
The patch below may not be the 100% correct way to alter this, but I'd
like to see a change something like this:
(BTW this is my first issue with the way complex OM code works, and I've
been doing quite a lot with it...)
Index: Object.vm
===================================================================
RCS file: /products/cvs/turbine/turbine/conf/torque/templates/om/Object.vm,v
retrieving revision 1.26
diff -u -r1.26 Object.vm
--- Object.vm 2001/02/08 02:43:57 1.26
+++ Object.vm 2001/02/14 15:13:43
@@ -75,11 +75,7 @@
#else
#set ( $varName = $tstrings.concat(["a", $tblFK.JavaName]) )
#end
- if ( $varName != null && !${varName}.isNew())
- {
- throw new Exception("Can't set a foreign key directly after an "
- + " association is already made based on saved data.");
- }
+ $varName = null;
#end
#foreach ($fk in $col.Referrers)
@@ -161,7 +157,6 @@
private $className $varName;
public void set${pVarName}($className v) throws Exception
{
- $varName = null;
#foreach ($columnName in $fk.LocalColumns)
#set ( $column = $table.getColumn($columnName) )
#set ( $colFKName = $fk.LocalForeignMapping.get($columnName) )
--
Sean Legassick
[EMAIL PROTECTED]
Czlowiekiem jestem i nic co ludzkie nie jest mi obce
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]