db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/generator/src/templates/om Object.vm ObjectWithManager.vm
Date Tue, 19 Aug 2003 09:48:51 GMT
mpoeschl    2003/08/19 02:48:51

  Modified:    src/generator/src/templates/om Object.vm
                        ObjectWithManager.vm
  Log:
  more formatting (no functional changes)
  
  Revision  Changes    Path
  1.7       +190 -199  db-torque/src/generator/src/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Object.vm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Object.vm	8 Aug 2003 09:49:11 -0000	1.6
  +++ Object.vm	19 Aug 2003 09:48:51 -0000	1.7
  @@ -67,6 +67,7 @@
           new ${table.JavaName}Peer();
   
   #if (!$table.isAlias())
  +  ## member variables
     #foreach ($col in $table.Columns)
       #set ( $cjtype = $col.JavaNative )
       #set ( $clo=$col.UncapitalisedJavaName )
  @@ -100,26 +101,25 @@
         #end
       #end
   
  -        /**
  -         * The value for the $clo field
  -         */
  -        private $cjtype $clo$defVal;
  +    /** The value for the $clo field */
  +    private $cjtype $clo$defVal;
     #end
   
  +  ## getter and setter methods
     #foreach ($col in $table.Columns)
       #set ( $cfc=$col.JavaName )
       #set ( $clo=$col.UncapitalisedJavaName )
       #set ( $cjtype = $col.JavaNative )
   
  -        /**
  -         * Get the $cfc
  -         *
  -         * @return $cjtype
  -         */
  -        public $cjtype get${cfc}()
  -        {
  -            return $clo;
  -        }
  +    /**
  +     * Get the $cfc
  +     *
  +     * @return $cjtype
  +     */
  +    public $cjtype get${cfc}()
  +    {
  +        return $clo;
  +    }
   
       #set ( $throwsClause = "" )
       #if ($complexObjectModel)
  @@ -133,30 +133,27 @@
         #end
       #end
   
  -        /**
  -         * Set the value of $cfc
  -         *
  -         * @param v new value
  -         */
  -        public void set${cfc}($cjtype v) $throwsClause
  -        {
  +    /**
  +     * Set the value of $cfc
  +     *
  +     * @param v new value
  +     */
  +    public void set${cfc}($cjtype v) $throwsClause
  +    {
       #if (($cjtype == "NumberKey") || ($cjtype == "StringKey") || ($cjtype == "DateKey"))
  -
  -            if (v != null && v.getValue() == null)
  -            {
  -                // If this is an Objectkey than this set method is
  -                // probably storing the id of this object or some
  -                // associated object.  If the objectKey value is null
  -                // then we convert the parameter to null so that this
  -                // property is consistently null to indicate that no
  -                // object is associated or defined.
  -                v = null;
  -            }
  +        if (v != null && v.getValue() == null)
  +        {
  +            // If this is an Objectkey than this set method is
  +            // probably storing the id of this object or some
  +            // associated object.  If the objectKey value is null
  +            // then we convert the parameter to null so that this
  +            // property is consistently null to indicate that no
  +            // object is associated or defined.
  +            v = null;
  +        }
       #end
   
  -
       #if ($addSaveMethod)
  -
         #if ($col.isPrimitive())
           if (this.$clo != v)
         #else
  @@ -167,7 +164,7 @@
               setModified(true);
           }
       #else
  -          this.$clo = v;
  +        this.$clo = v;
       #end
   
       #if ($complexObjectModel)
  @@ -189,7 +186,7 @@
           #end
   
           #if($colFK.Primitive)
  -        if ($varName != null && !(${varName}.get${colFK.JavaName}()==v))
  +        if ($varName != null && !(${varName}.get${colFK.JavaName}() == v))
           #else
           if ($varName != null && !ObjectUtils.equals(${varName}.get${colFK.JavaName}(), v))
           #end
  @@ -209,15 +206,15 @@
               #set ( $collName = "coll${tblFK.JavaName}s" )
             #end
   
  -              // update associated $tblFK.JavaName
  -              if ($collName != null)
  -              {
  -                  for (int i = 0; i < ${collName}.size(); i++)
  -                  {
  -                      ((${tblFK.JavaName}) ${collName}.get(i))
  -                          .set${colFK.JavaName}(v);
  -                  }
  -              }
  +        // update associated $tblFK.JavaName
  +        if ($collName != null)
  +        {
  +            for (int i = 0; i < ${collName}.size(); i++)
  +            {
  +                ((${tblFK.JavaName}) ${collName}.get(i))
  +                    .set${colFK.JavaName}(v);
  +            }
  +        }
           #end
         #end
       #end
  @@ -226,7 +223,6 @@
   #end
   
   ##association code
  -
   #if ($complexObjectModel)
     #set($pVars = [])  ## Array of object set method names for later reference.
     #set($aVars = [])  ## Array of object field names for later reference.
  @@ -272,7 +268,7 @@
             #set ($coldefval = $column.DefaultValue)
               set${column.JavaName}($coldefval);
             #else
  -            set${column.JavaName}(($column.JavaNative)null);
  +            set${column.JavaName}(($column.JavaNative) null);
             #end
           }
           else
  @@ -336,7 +332,7 @@
                  never be used.
                  $className obj = ${className}Peer.retrieveByPK($arglist);
                  obj.add${pCollName}(this);
  -             */
  +            */
           }
           return $varName;
       }
  @@ -364,37 +360,36 @@
   
             #set ($fktype = $col.JavaNative)
             #if ($fktype == "short")
  -                set${col.JavaName}(((NumberKey) keys[$i]).shortValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).shortValue());
             #elseif($fktype == "int")
  -                set${col.JavaName}(((NumberKey) keys[$i]).intValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).intValue());
             #elseif($fktype == "long")
  -                set${col.JavaName}(((NumberKey) keys[$i]).longValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).longValue());
             #elseif($fktype == "BigDecimal")
  -                set${col.JavaName}(((NumberKey) keys[$i]).getBigDecimal());
  +        set${col.JavaName}(((NumberKey) keys[$i]).getBigDecimal());
             #elseif($fktype == "byte") )
  -                set${col.JavaName}(((NumberKey) keys[$i]).byteValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).byteValue());
             #elseif($fktype == "float")
  -                set${col.JavaName}(((NumberKey) keys[$i]).floatValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).floatValue());
             #elseif($fktype == "double")
  -                set${col.JavaName}(((NumberKey) keys[$i]).doubleValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).doubleValue());
             #elseif($fktype == "Short")
  -                set${col.JavaName}(new Short(((NumberKey) keys[$i]).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey) keys[$i]).shortValue()));
             #elseif($fktype == "Integer")
  -                set${col.JavaName}(new Integer(((NumberKey) keys[$i]).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey) keys[$i]).intValue()));
             #elseif($fktype == "Long")
  -                set${col.JavaName}(new Long(((NumberKey) keys[$i]).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey) keys[$i]).longValue()));
             #elseif($fktype == "Byte") )
  -                set${col.JavaName}(new Byte(((NumberKey) keys[$i]).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey) keys[$i]).byteValue()));
             #elseif($fktype == "Float")
  -                set${col.JavaName}(new Float(((NumberKey) keys[$i]).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey) keys[$i]).floatValue()));
             #elseif($fktype == "Double")
  -                set${col.JavaName}(new Double(((NumberKey) keys[$i]).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey) keys[$i]).doubleValue()));
             #elseif($fktype == "String")
  -                set${col.JavaName}(keys[$i].toString());
  +        set${col.JavaName}(keys[$i].toString());
             #elseif($fktype == "Date")
  -                set${col.JavaName}(((DateKey)keys[$i]).getDate());
  +        set${col.JavaName}(((DateKey)keys[$i]).getDate());
             #end
  -
             #set ( $i = $i + 1 )
           #end
         #else
  @@ -403,35 +398,35 @@
   
           #set ($fktype = $col.JavaNative)
           #if ($fktype == "short")
  -                set${col.JavaName}(((NumberKey) key).shortValue());
  +        set${col.JavaName}(((NumberKey) key).shortValue());
           #elseif($fktype == "int")
  -                set${col.JavaName}(((NumberKey) key).intValue());
  +        set${col.JavaName}(((NumberKey) key).intValue());
           #elseif($fktype == "long")
  -                set${col.JavaName}(((NumberKey) key).longValue());
  +        set${col.JavaName}(((NumberKey) key).longValue());
           #elseif($fktype == "BigDecimal")
  -                set${col.JavaName}(((NumberKey) key).getBigDecimal());
  +        set${col.JavaName}(((NumberKey) key).getBigDecimal());
           #elseif($fktype == "byte") )
  -                set${col.JavaName}(((NumberKey) key).byteValue());
  +        set${col.JavaName}(((NumberKey) key).byteValue());
           #elseif($fktype == "float")
  -                set${col.JavaName}(((NumberKey) key).floatValue());
  +        set${col.JavaName}(((NumberKey) key).floatValue());
           #elseif($fktype == "double")
  -                set${col.JavaName}(((NumberKey) key).doubleValue());
  +        set${col.JavaName}(((NumberKey) key).doubleValue());
           #elseif($fktype == "Short")
  -                set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
           #elseif($fktype == "Integer")
  -                set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
           #elseif($fktype == "Long")
  -                set${col.JavaName}(new Long(((NumberKey) key).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey) key).longValue()));
           #elseif($fktype == "Byte") )
  -                set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
           #elseif($fktype == "Float")
  -                set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
           #elseif($fktype == "Double")
  -                set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
           #elseif($fktype == "String")
  -                set${col.JavaName}(key.toString());
  +        set${col.JavaName}(key.toString());
           #elseif($fktype == "Date")
  -                set${col.JavaName}(((DateKey)key).getDate());
  +        set${col.JavaName}(((DateKey)key).getDate());
           #end
         #end
       }
  @@ -747,7 +742,7 @@
                 #set ( $column = $table.getColumn($columnName) )
                 #set ( $colFKName = $fk.ForeignLocalMapping.get($columnName) )
                 #set ( $colFK = $tblFK.getColumn($colFKName) )
  -                criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
  +            criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}());
               #end
               if (!last${relCol}Criteria.equals(criteria))
               {
  @@ -825,9 +820,7 @@
   *#
   ## ------------------------------------------------------------
   
  -
     #end    ## ends foreach over table.Referrers
  -
   #end    ##ends the if(complexObjectModel)
   
   ##
  @@ -843,15 +836,15 @@
        */
       public static synchronized List getFieldNames()
       {
  -      if (fieldNames == null)
  -      {
  -        fieldNames = new ArrayList();
  +        if (fieldNames == null)
  +        {
  +            fieldNames = new ArrayList();
     #foreach ($col in $table.Columns)
  -        fieldNames.add("${col.JavaName}");
  +            fieldNames.add("${col.JavaName}");
     #end
  -        fieldNames = Collections.unmodifiableList(fieldNames);
  -      }
  -      return fieldNames;
  +            fieldNames = Collections.unmodifiableList(fieldNames);
  +        }
  +        return fieldNames;
       }
   
       /**
  @@ -866,30 +859,31 @@
       #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
           if (name.equals("${col.JavaName}"))
  -    {
  +        {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
     #end
           return null;
       }
  +    
       /**
        * Retrieves a field from the object by name passed in
        * as a String.  The String must be one of the static
  @@ -907,25 +901,25 @@
           if (name.equals(${table.JavaName}Peer.$cup))
           {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
     #end
           return null;
       }
  @@ -943,28 +937,28 @@
     #foreach ($col in $table.Columns)
       #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
  -    if (pos == $i)
  -    {
  +        if (pos == $i)
  +        {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
       #set ($i = $i + 1)
     #end
           return null;
  @@ -981,7 +975,7 @@
       public void save() throws $saveException
       {
     #if ($complexObjectModel)
  -            save(${table.JavaName}Peer.getMapBuilder()
  +        save(${table.JavaName}Peer.getMapBuilder()
                   .getDatabaseMap().getName());
     #else
           if (isModified())
  @@ -1026,7 +1020,6 @@
               Transaction.safeRollback(con);
               throw e;
           }
  -
     #else
           if (isModified())
           {
  @@ -1050,7 +1043,6 @@
                   Torque.closeConnection(con);
               }
           }
  -
     #end
       }
   
  @@ -1072,9 +1064,9 @@
       public void save(Connection con) throws TorqueException
       {
     #if ($complexObjectModel)
  -      if (!alreadyInSave)
  -      {
  -        alreadyInSave = true;
  +        if (!alreadyInSave)
  +        {
  +            alreadyInSave = true;
   
   #* FIXME! the following code can cause an infinite loop, needs more thought
   shows the infinite loop: System.out.println("Entering save for " + this);
  @@ -1098,22 +1090,21 @@
         #end
       #end
   *#
  -
     #end
   
  -        // If this object has been modified, then save it to the database.
  -        if (isModified())
  -        {
  -            if (isNew())
  -            {
  -                ${table.JavaName}Peer.doInsert(($table.JavaName) this, con);
  -                setNew(false);
  -            }
  -            else
  +            // If this object has been modified, then save it to the database.
  +            if (isModified())
               {
  -                ${table.JavaName}Peer.doUpdate(($table.JavaName) this, con);
  +                if (isNew())
  +                {
  +                    ${table.JavaName}Peer.doInsert(($table.JavaName) this, con);
  +                    setNew(false);
  +                }
  +                else
  +                {
  +                    ${table.JavaName}Peer.doUpdate(($table.JavaName) this, con);
  +                }
               }
  -        }
   
     #if ($complexObjectModel)
       #foreach ($fk in $table.Referrers)
  @@ -1135,19 +1126,19 @@
           #end
           #set ( $collName = "coll$relCol" )
   
  -          if ($collName != null)
  -          {
  -              for (int i = 0; i < ${collName}.size(); i++)
  -              {
  -                  ((${className}) ${collName}.get(i)).save(con);
  -              }
  -          }
  +            if ($collName != null)
  +            {
  +                for (int i = 0; i < ${collName}.size(); i++)
  +                {
  +                    ((${className}) ${collName}.get(i)).save(con);
  +                }
  +            }
         #end
       #end
     #end
     #if ($complexObjectModel)
  -        alreadyInSave = false;
  -      }
  +            alreadyInSave = false;
  +        }
     #end
       }
   #end
  @@ -1185,37 +1176,37 @@
           $throwsClause
       {
       #if ($cjtype == "short")
  -            set${col.JavaName}(((NumberKey) key).shortValue());
  +        set${col.JavaName}(((NumberKey) key).shortValue());
       #elseif($cjtype == "int")
  -            set${col.JavaName}(((NumberKey) key).intValue());
  +        set${col.JavaName}(((NumberKey) key).intValue());
       #elseif($cjtype == "long")
  -            set${col.JavaName}(((NumberKey) key).longValue());
  +        set${col.JavaName}(((NumberKey) key).longValue());
       #elseif($cjtype == "BigDecimal")
  -            set${col.JavaName}(((NumberKey) key).getBigDecimal());
  +        set${col.JavaName}(((NumberKey) key).getBigDecimal());
       #elseif($cjtype == "byte") )
  -            set${col.JavaName}(((NumberKey) key).byteValue());
  +        set${col.JavaName}(((NumberKey) key).byteValue());
       #elseif($cjtype == "float")
  -            set${col.JavaName}(((NumberKey) key).floatValue());
  +        set${col.JavaName}(((NumberKey) key).floatValue());
       #elseif($cjtype == "double")
  -            set${col.JavaName}(((NumberKey) key).doubleValue());
  +        set${col.JavaName}(((NumberKey) key).doubleValue());
       #elseif($cjtype == "Short")
  -            set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
       #elseif($cjtype == "Integer")
  -            set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
       #elseif($cjtype == "Long")
  -            set${col.JavaName}(new Long(((NumberKey) key).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey) key).longValue()));
       #elseif($cjtype == "Byte") )
  -            set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
       #elseif($cjtype == "Float")
  -            set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
       #elseif($cjtype == "Double")
  -            set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
       #elseif($cjtype == "String")
  -            set${col.JavaName}(key.toString());
  +        set${col.JavaName}(key.toString());
       #elseif($cjtype == "Date")
  -            set${col.JavaName}(((DateKey)key).getDate());
  +        set${col.JavaName}(((DateKey)key).getDate());
       #else
  -            set${col.JavaName}(($cjtype)key);
  +        set${col.JavaName}(($cjtype)key);
       #end
       }
   
  @@ -1227,37 +1218,37 @@
       public void setPrimaryKey(String key) $throwsClause
       {
       #if ($cjtype == "short")
  -            set${col.JavaName}(Short.parseShort(key));
  +        set${col.JavaName}(Short.parseShort(key));
       #elseif($cjtype == "int")
  -            set${col.JavaName}(Integer.parseInt(key));
  +        set${col.JavaName}(Integer.parseInt(key));
       #elseif($cjtype == "long")
  -            set${col.JavaName}(Long.parseLong(key));
  +        set${col.JavaName}(Long.parseLong(key));
       #elseif($cjtype == "BigDecimal")
  -            set${col.JavaName}(new BigDecimal(key));
  +        set${col.JavaName}(new BigDecimal(key));
       #elseif($cjtype == "byte") )
  -            set${col.JavaName}(Byte.parseByte(key));
  +        set${col.JavaName}(Byte.parseByte(key));
       #elseif($cjtype == "float")
  -            set${col.JavaName}(Float.parseFloat(key));
  +        set${col.JavaName}(Float.parseFloat(key));
       #elseif($cjtype == "double")
  -            set${col.JavaName}(Double.parseDouble(key));
  +        set${col.JavaName}(Double.parseDouble(key));
       #elseif($cjtype == "Short")
  -            set${col.JavaName}(new Short(key));
  +        set${col.JavaName}(new Short(key));
       #elseif($cjtype == "Integer")
  -            set${col.JavaName}(new Integer(key));
  +        set${col.JavaName}(new Integer(key));
       #elseif($cjtype == "Long")
  -            set${col.JavaName}(new Long(key));
  +        set${col.JavaName}(new Long(key));
       #elseif($cjtype == "Byte") )
  -            set${col.JavaName}(new Byte(key));
  +        set${col.JavaName}(new Byte(key));
       #elseif($cjtype == "Float")
  -            set${col.JavaName}(new Float(key));
  +        set${col.JavaName}(new Float(key));
       #elseif($cjtype == "Double")
  -            set${col.JavaName}(new Double(key));
  +        set${col.JavaName}(new Double(key));
       #elseif($cjtype == "String")
  -            set${col.JavaName}(key);
  +        set${col.JavaName}(key);
       #elseif($cjtype == "Date")
  -            set${col.JavaName}(new Date(key));
  +        set${col.JavaName}(new Date(key));
       #else
  -            set${col.JavaName}(new ${cjtype}(key));
  +        set${col.JavaName}(new ${cjtype}(key));
       #end
       }
   
  @@ -1265,6 +1256,7 @@
   
       private final SimpleKey[] pks = new SimpleKey[$table.PrimaryKey.size()];
       private final ComboKey comboPK = new ComboKey(pks);
  +    
       /**
        * Set the PrimaryKey with an ObjectKey
        *
  @@ -1278,35 +1270,35 @@
       #foreach ($pk in $table.PrimaryKey)
         #set ($pktype = $pk.JavaNative)
         #if ($pktype == "short")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).shortValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).shortValue());
         #elseif($pktype == "int")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).intValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).intValue());
         #elseif($pktype == "long")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).longValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).longValue());
         #elseif($pktype == "BigDecimal")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).getBigDecimal());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).getBigDecimal());
         #elseif($pktype == "byte") )
  -            set${pk.JavaName}(((NumberKey)keys[$i]).byteValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).byteValue());
         #elseif($pktype == "float")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).floatValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).floatValue());
         #elseif($pktype == "double")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).doubleValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).doubleValue());
         #elseif($pktype == "Short")
  -            set${pk.JavaName}(new Short(((NumberKey)keys[$i]).shortValue()));
  +        set${pk.JavaName}(new Short(((NumberKey)keys[$i]).shortValue()));
         #elseif($pktype == "Integer")
  -            set${pk.JavaName}(new Integer(((NumberKey)keys[$i]).intValue()));
  +        set${pk.JavaName}(new Integer(((NumberKey)keys[$i]).intValue()));
         #elseif($pktype == "Long")
  -            set${pk.JavaName}(new Long(((NumberKey)keys[$i]).longValue()));
  +        set${pk.JavaName}(new Long(((NumberKey)keys[$i]).longValue()));
         #elseif($pktype == "Byte") )
  -            set${pk.JavaName}(new Byte(((NumberKey)keys[$i]).byteValue()));
  +        set${pk.JavaName}(new Byte(((NumberKey)keys[$i]).byteValue()));
         #elseif($pktype == "Float")
  -            set${pk.JavaName}(new Float(((NumberKey)keys[$i]).floatValue()));
  +        set${pk.JavaName}(new Float(((NumberKey)keys[$i]).floatValue()));
         #elseif($pktype == "Double")
  -            set${pk.JavaName}(new Double(((NumberKey)keys[$i]).doubleValue()));
  +        set${pk.JavaName}(new Double(((NumberKey)keys[$i]).doubleValue()));
         #elseif($pktype == "String")
  -            set${pk.JavaName}(keys[$i].toString());
  +        set${pk.JavaName}(keys[$i].toString());
         #elseif($pktype == "Date")
  -            set${pk.JavaName}(((DateKey)keys[$i]).getDate());
  +        set${pk.JavaName}(((DateKey)keys[$i]).getDate());
         #end
         #set ( $i = $i + 1 )
       #end
  @@ -1325,7 +1317,7 @@
           $throwsClause
       {
       #foreach ($col in $table.PrimaryKey)
  -         set${col.JavaName}($col.UncapitalisedJavaName);
  +        set${col.JavaName}($col.UncapitalisedJavaName);
       #end
       }
   
  @@ -1336,7 +1328,6 @@
       {
           setPrimaryKey(new ComboKey(key));
       }
  -
     #end
   
       /**
  @@ -1418,11 +1409,11 @@
         #if($col.Primitive)
           #set ($coldefval = "0")
           #set ($coldefval = $col.DefaultValue)
  -          copyObj.set${col.JavaName}($coldefval);
  +        copyObj.set${col.JavaName}($coldefval);
         #else
           #set ( $pkid = "null" )
           #set ( $cjtype = $col.JavaNative )
  -          copyObj.set${col.JavaName}((${cjtype})${pkid});
  +        copyObj.set${col.JavaName}((${cjtype})${pkid});
         #end
       #end
     #end
  
  
  
  1.5       +195 -197  db-torque/src/generator/src/templates/om/ObjectWithManager.vm
  
  Index: ObjectWithManager.vm
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/templates/om/ObjectWithManager.vm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ObjectWithManager.vm	8 Aug 2003 09:49:11 -0000	1.4
  +++ ObjectWithManager.vm	19 Aug 2003 09:48:51 -0000	1.5
  @@ -101,10 +101,8 @@
         #end
       #end
   
  -        /**
  -         * The value for the $clo field
  -         */
  -        private $cjtype $clo$defVal;
  +    /** The value for the $clo field */
  +    private $cjtype $clo$defVal;
     #end
   
     #foreach ($col in $table.Columns)
  @@ -112,14 +110,14 @@
       #set ( $clo=$col.UncapitalisedJavaName )
       #set ( $cjtype = $col.JavaNative )
   
  -        /**
  -         * Get the $cfc
  -         * @return $cjtype
  -         */
  -        public $cjtype get${cfc}()
  -        {
  -          return $clo;
  -        }
  +    /**
  +     * Get the $cfc
  +     * @return $cjtype
  +     */
  +    public $cjtype get${cfc}()
  +    {
  +        return $clo;
  +    }
   
       #set ( $throwsClause = "" )
       #if ($complexObjectModel)
  @@ -133,37 +131,36 @@
         #end
       #end
   
  -        /**
  -         * Set the value of $cfc
  -         */
  -        public void set${cfc}($cjtype v ) $throwsClause
  -        {
  +    /**
  +     * Set the value of $cfc
  +     */
  +    public void set${cfc}($cjtype v ) $throwsClause
  +    {
       #if (($cjtype == "NumberKey") || ($cjtype == "StringKey") || ($cjtype == "DateKey"))
  -            if (v != null && v.getValue() == null)
  -            {
  -                // If this is an Objectkey than this set method is
  -                // probably storing the id of this object or some
  -                // associated object.  If the objectKey value is null
  -                // then we convert the parameter to null so that this
  -                // property is consistently null to indicate that no
  -                // object is associated or defined.
  -                v = null;
  -            }
  +        if (v != null && v.getValue() == null)
  +        {
  +            // If this is an Objectkey than this set method is
  +            // probably storing the id of this object or some
  +            // associated object.  If the objectKey value is null
  +            // then we convert the parameter to null so that this
  +            // property is consistently null to indicate that no
  +            // object is associated or defined.
  +            v = null;
  +        }
       #end
   
       #if ($addSaveMethod)
         #if ($col.isPrimitive())
           if (this.$clo != v)
  -        {
         #else
  -        if ( !ObjectUtils.equals(this.$clo, v) )
  -        {
  +        if (!ObjectUtils.equals(this.$clo, v))
         #end
  +        {
               this.$clo = v;
               setModified(true);
           }
       #else
  -          this.$clo = v;
  +        this.$clo = v;
       #end
   
       #if ($complexObjectModel)
  @@ -189,7 +186,7 @@
           #end
   
           #if($colFK.Primitive)
  -        if ($varName != null && !(${varName}.get${colFK.JavaName}()==v))
  +        if ($varName != null && !(${varName}.get${colFK.JavaName}() == v))
           #else
           if ($varName != null && !ObjectUtils.equals(${varName}.get${colFK.JavaName}(), v))
           #end
  @@ -209,19 +206,19 @@
               #set ( $collName = "coll${tblFK.JavaName}s" )
             #end
   
  -              // update associated $tblFK.JavaName
  -              if ($collName != null )
  -              {
  -                  for (int i=0; i<${collName}.size(); i++)
  -                  {
  -                      ((${tblFK.JavaName})${collName}.get(i))
  -                          .set${colFK.JavaName}(v);
  -                  }
  -              }
  +        // update associated $tblFK.JavaName
  +        if ($collName != null )
  +        {
  +            for (int i = 0; i < ${collName}.size(); i++)
  +            {
  +                ((${tblFK.JavaName})${collName}.get(i))
  +                        .set${colFK.JavaName}(v);
  +            }
  +        }
           #end
         #end
       #end
  -     }
  +    }
   
     #end
   #end
  @@ -308,10 +305,10 @@
           if ( $conditional )
           {
       #if ($argsize > 1)
  -       SimpleKey[] keys = { $arglist };
  -        return ${interfaceName}Manager.getInstance(new ComboKey(keys));
  +            SimpleKey[] keys = { $arglist };
  +            return ${interfaceName}Manager.getInstance(new ComboKey(keys));
       #else
  -        return ${interfaceName}Manager.getInstance($arglist);
  +            return ${interfaceName}Manager.getInstance($arglist);
       #end
           }
           return $varName;
  @@ -339,35 +336,35 @@
           #set ($col = $table.getColumn($colName) )
           #set ($fktype = $col.JavaNative)
           #if ($fktype == "short")
  -                set${col.JavaName}(((NumberKey) keys[$i]).shortValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).shortValue());
           #elseif($fktype == "int")
  -                set${col.JavaName}(((NumberKey) keys[$i]).intValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).intValue());
           #elseif($fktype == "long")
  -                set${col.JavaName}(((NumberKey) keys[$i]).longValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).longValue());
           #elseif($fktype == "BigDecimal")
  -                set${col.JavaName}(((NumberKey) keys[$i]).getBigDecimal());
  +        set${col.JavaName}(((NumberKey) keys[$i]).getBigDecimal());
           #elseif($fktype == "byte") )
  -                set${col.JavaName}(((NumberKey) keys[$i]).byteValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).byteValue());
           #elseif($fktype == "float")
  -                set${col.JavaName}(((NumberKey) keys[$i]).floatValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).floatValue());
           #elseif($fktype == "double")
  -                set${col.JavaName}(((NumberKey) keys[$i]).doubleValue());
  +        set${col.JavaName}(((NumberKey) keys[$i]).doubleValue());
           #elseif($fktype == "Short")
  -                set${col.JavaName}(new Short(((NumberKey) keys[$i]).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey) keys[$i]).shortValue()));
           #elseif($fktype == "Integer")
  -                set${col.JavaName}(new Integer(((NumberKey) keys[$i]).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey) keys[$i]).intValue()));
           #elseif($fktype == "Long")
  -                set${col.JavaName}(new Long(((NumberKey) keys[$i]).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey) keys[$i]).longValue()));
           #elseif($fktype == "Byte") )
  -                set${col.JavaName}(new Byte(((NumberKey) keys[$i]).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey) keys[$i]).byteValue()));
           #elseif($fktype == "Float")
  -                set${col.JavaName}(new Float(((NumberKey) keys[$i]).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey) keys[$i]).floatValue()));
           #elseif($fktype == "Double")
  -                set${col.JavaName}(new Double(((NumberKey) keys[$i]).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey) keys[$i]).doubleValue()));
           #elseif($fktype == "String")
  -                set${col.JavaName}(keys[$i].toString());
  +        set${col.JavaName}(keys[$i].toString());
           #elseif($fktype == "Date")
  -                set${col.JavaName}(((DateKey)keys[$i]).getDate());
  +        set${col.JavaName}(((DateKey)keys[$i]).getDate());
           #end
   
           #set ( $i = $i + 1 )
  @@ -378,35 +375,35 @@
   
         #set ($fktype = $col.JavaNative)
         #if ($fktype == "short")
  -            set${col.JavaName}(((NumberKey) key).shortValue());
  +        set${col.JavaName}(((NumberKey) key).shortValue());
         #elseif($fktype == "int")
  -            set${col.JavaName}(((NumberKey) key).intValue());
  +        set${col.JavaName}(((NumberKey) key).intValue());
         #elseif($fktype == "long")
  -            set${col.JavaName}(((NumberKey) key).longValue());
  +        set${col.JavaName}(((NumberKey) key).longValue());
         #elseif($fktype == "BigDecimal")
  -            set${col.JavaName}(((NumberKey) key).getBigDecimal());
  +        set${col.JavaName}(((NumberKey) key).getBigDecimal());
         #elseif($fktype == "byte") )
  -            set${col.JavaName}(((NumberKey) key).byteValue());
  +        set${col.JavaName}(((NumberKey) key).byteValue());
         #elseif($fktype == "float")
  -            set${col.JavaName}(((NumberKey) key).floatValue());
  +        set${col.JavaName}(((NumberKey) key).floatValue());
         #elseif($fktype == "double")
  -            set${col.JavaName}(((NumberKey) key).doubleValue());
  +        set${col.JavaName}(((NumberKey) key).doubleValue());
         #elseif($fktype == "Short")
  -            set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey) key).shortValue()));
         #elseif($fktype == "Integer")
  -            set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey) key).intValue()));
         #elseif($fktype == "Long")
  -            set${col.JavaName}(new Long(((NumberKey) key).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey) key).longValue()));
         #elseif($fktype == "Byte") )
  -            set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey) key).byteValue()));
         #elseif($fktype == "Float")
  -            set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey) key).floatValue()));
         #elseif($fktype == "Double")
  -            set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey) key).doubleValue()));
         #elseif($fktype == "String")
  -            set${col.JavaName}(key.toString());
  +        set${col.JavaName}(key.toString());
         #elseif($fktype == "Date")
  -            set${col.JavaName}(((DateKey)key).getDate());
  +        set${col.JavaName}(((DateKey)key).getDate());
         #end
       #end
       }
  @@ -698,7 +695,7 @@
       {
           if ($collName == null)
           {
  -            if ( isNew() )
  +            if (isNew())
               {
                  $collName = new ArrayList();
               }
  @@ -725,7 +722,7 @@
                 #set ( $colFK = $tblFK.getColumn($colFKName) )
                   criteria.add(${className}Peer.${colFK.Name.toUpperCase()}, get${column.JavaName}() );
               #end
  -            if ( !last${relCol}Criteria.equals(criteria)  )
  +            if (!last${relCol}Criteria.equals(criteria))
               {
                   $collName = ${className}Peer.doSelectJoin${relCol2}(criteria);
               }
  @@ -815,15 +812,15 @@
        */
       public static synchronized List getFieldNames()
       {
  -      if (fieldNames == null)
  -      {
  -        fieldNames = new ArrayList();
  +        if (fieldNames == null)
  +        {
  +            fieldNames = new ArrayList();
     #foreach ($col in $table.Columns)
  -        fieldNames.add("${col.JavaName}");
  +            fieldNames.add("${col.JavaName}");
     #end
  -        fieldNames = Collections.unmodifiableList(fieldNames);
  -      }
  -      return fieldNames;
  +            fieldNames = Collections.unmodifiableList(fieldNames);
  +        }
  +        return fieldNames;
       }
   
       /**
  @@ -836,30 +833,31 @@
       #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
           if (name.equals("${col.JavaName}"))
  -    {
  +        {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
     #end
           return null;
       }
  +    
       /**
        * Retrieves a field from the object by name passed in
        * as a String.  The String must be one of the static
  @@ -874,25 +872,25 @@
           if (name.equals(${table.JavaName}Peer.$cup ))
           {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
     #end
           return null;
       }
  @@ -907,28 +905,28 @@
     #foreach ($col in $table.Columns)
       #set ( $cfc = $col.JavaName )
       #set ( $cjtype = $col.JavaNative )
  -    if ( pos == $i )
  -    {
  +        if ( pos == $i )
  +        {
       #if ($cjtype == "int")
  -        return new Integer(get${cfc}());
  +            return new Integer(get${cfc}());
       #elseif ($cjtype == "long")
  -        return new Long(get${cfc}());
  +            return new Long(get${cfc}());
       #elseif ($cjtype == "float")
  -        return new Float(get${cfc}());
  +            return new Float(get${cfc}());
       #elseif ($cjtype == "double")
  -        return new Double(get${cfc}());
  +            return new Double(get${cfc}());
       #elseif ($cjtype == "boolean")
  -        return new Boolean(get${cfc}());
  +            return new Boolean(get${cfc}());
       #elseif ($cjtype == "short")
  -        return new Short(get${cfc}());
  +            return new Short(get${cfc}());
       #elseif ($cjtype == "byte")
  -        return new Byte(get${cfc}());
  +            return new Byte(get${cfc}());
       #elseif ($cjtype == "char")
  -        return new Character(get${cfc}());
  +            return new Character(get${cfc}());
       #else
  -        return get${cfc}();
  +            return get${cfc}();
       #end
  -    }
  +        }
       #set ($i = $i + 1)
     #end
           return null;
  @@ -943,7 +941,7 @@
       public void save() throws $saveException
       {
     #if ($complexObjectModel)
  -            save(${table.JavaName}Peer.getMapBuilder()
  +        save(${table.JavaName}Peer.getMapBuilder()
                   .getDatabaseMap().getName());
     #else
           if (isModified())
  @@ -1026,9 +1024,9 @@
       public void save(Connection con) throws TorqueException
       {
     #if ($complexObjectModel)
  -      if (!alreadyInSave)
  -      {
  -        alreadyInSave = true;
  +        if (!alreadyInSave)
  +        {
  +            alreadyInSave = true;
   
   #* FIXME! the following code can cause an infinite loop, needs more thought
   shows the infinite loop: System.out.println("Entering save for " + this);
  @@ -1052,33 +1050,32 @@
         #end
       #end
   *#
  -
     #end
   
  -        // If this object has been modified, then save it to the database.
  -        if (isModified())
  -        {
  -            if (isNew())
  +            // If this object has been modified, then save it to the database.
  +            if (isModified())
               {
  -                ${table.JavaName}Peer.doInsert(($table.JavaName)this, con);
  -                setNew(false);
  -            }
  -            else
  -            {
  -                ${table.JavaName}Peer.doUpdate(($table.JavaName)this, con);
  -            }
  +                if (isNew())
  +                {
  +                    ${table.JavaName}Peer.doInsert(($table.JavaName)this, con);
  +                    setNew(false);
  +                }
  +                else
  +                {
  +                    ${table.JavaName}Peer.doUpdate(($table.JavaName)this, con);
  +                }
   
     #if ($table.PrimaryKey.size() > 0)
       #set ($interfaceName = $table.JavaName)
       #if ($table.Interface)
         #set ($interfaceName = $table.Interface)
       #end
  -            if (isCacheOnSave())
  -            {
  -                ${interfaceName}Manager.putInstance(this);
  -            }
  +                if (isCacheOnSave())
  +                {
  +                    ${interfaceName}Manager.putInstance(this);
  +                }
     #end
  -        }
  +            }
   
     #if ($complexObjectModel)
       #foreach ($fk in $table.Referrers)
  @@ -1099,19 +1096,19 @@
             #set ( $relCol = "${className}sRelatedBy$relCol" )
           #end
           #set ( $collName = "coll$relCol" )
  -          if ($collName != null )
  -          {
  -              for (int i = 0; i < ${collName}.size(); i++)
  -              {
  -                  ((${className})${collName}.get(i)).save(con);
  -              }
  -          }
  +            if ($collName != null )
  +            {
  +                for (int i = 0; i < ${collName}.size(); i++)
  +                {
  +                    ((${className})${collName}.get(i)).save(con);
  +                }
  +            }
         #end
       #end
     #end
     #if ($complexObjectModel)
  -        alreadyInSave = false;
  -      }
  +            alreadyInSave = false;
  +        }
     #end
       }
   #end
  @@ -1158,37 +1155,37 @@
       public void setPrimaryKey(ObjectKey $clo)
           $throwsClause {
       #if ($cjtype == "short")
  -            set${col.JavaName}(((NumberKey)$clo).shortValue());
  +        set${col.JavaName}(((NumberKey)$clo).shortValue());
       #elseif($cjtype == "int")
  -            set${col.JavaName}(((NumberKey)$clo).intValue());
  +        set${col.JavaName}(((NumberKey)$clo).intValue());
       #elseif($cjtype == "long")
  -            set${col.JavaName}(((NumberKey)$clo).longValue());
  +        set${col.JavaName}(((NumberKey)$clo).longValue());
       #elseif($cjtype == "BigDecimal")
  -            set${col.JavaName}(((NumberKey)$clo).getBigDecimal());
  +        set${col.JavaName}(((NumberKey)$clo).getBigDecimal());
       #elseif($cjtype == "byte") )
  -            set${col.JavaName}(((NumberKey)$clo).byteValue());
  +        set${col.JavaName}(((NumberKey)$clo).byteValue());
       #elseif($cjtype == "float")
  -            set${col.JavaName}(((NumberKey)$clo).floatValue());
  +        set${col.JavaName}(((NumberKey)$clo).floatValue());
       #elseif($cjtype == "double")
  -            set${col.JavaName}(((NumberKey)$clo).doubleValue());
  +        set${col.JavaName}(((NumberKey)$clo).doubleValue());
       #elseif($cjtype == "Short")
  -            set${col.JavaName}(new Short(((NumberKey)$clo).shortValue()));
  +        set${col.JavaName}(new Short(((NumberKey)$clo).shortValue()));
       #elseif($cjtype == "Integer")
  -            set${col.JavaName}(new Integer(((NumberKey)$clo).intValue()));
  +        set${col.JavaName}(new Integer(((NumberKey)$clo).intValue()));
       #elseif($cjtype == "Long")
  -            set${col.JavaName}(new Long(((NumberKey)$clo).longValue()));
  +        set${col.JavaName}(new Long(((NumberKey)$clo).longValue()));
       #elseif($cjtype == "Byte") )
  -            set${col.JavaName}(new Byte(((NumberKey)$clo).byteValue()));
  +        set${col.JavaName}(new Byte(((NumberKey)$clo).byteValue()));
       #elseif($cjtype == "Float")
  -            set${col.JavaName}(new Float(((NumberKey)$clo).floatValue()));
  +        set${col.JavaName}(new Float(((NumberKey)$clo).floatValue()));
       #elseif($cjtype == "Double")
  -            set${col.JavaName}(new Double(((NumberKey)$clo).doubleValue()));
  +        set${col.JavaName}(new Double(((NumberKey)$clo).doubleValue()));
       #elseif($cjtype == "String")
  -            set${col.JavaName}(${clo}.toString());
  +        set${col.JavaName}(${clo}.toString());
       #elseif($cjtype == "Date")
  -            set${col.JavaName}(((DateKey)$clo).getDate());
  +        set${col.JavaName}(((DateKey)$clo).getDate());
       #else
  -            set${col.JavaName}(($cjtype)$clo);
  +        set${col.JavaName}(($cjtype)$clo);
       #end
       }
   
  @@ -1198,37 +1195,37 @@
       public void setPrimaryKey(String key) $throwsClause
       {
       #if ($cjtype == "short")
  -            set${col.JavaName}(Short.parseShort(key));
  +        set${col.JavaName}(Short.parseShort(key));
       #elseif($cjtype == "int")
  -            set${col.JavaName}(Integer.parseInt(key));
  +        set${col.JavaName}(Integer.parseInt(key));
       #elseif($cjtype == "long")
  -            set${col.JavaName}(Long.parseLong(key));
  +        set${col.JavaName}(Long.parseLong(key));
       #elseif($cjtype == "BigDecimal")
  -            set${col.JavaName}(new BigDecimal(key));
  +        set${col.JavaName}(new BigDecimal(key));
       #elseif($cjtype == "byte") )
  -            set${col.JavaName}(Byte.parseByte(key));
  +        set${col.JavaName}(Byte.parseByte(key));
       #elseif($cjtype == "float")
  -            set${col.JavaName}(Float.parseFloat(key));
  +        set${col.JavaName}(Float.parseFloat(key));
       #elseif($cjtype == "double")
  -            set${col.JavaName}(Double.parseDouble(key));
  +        set${col.JavaName}(Double.parseDouble(key));
       #elseif($cjtype == "Short")
  -            set${col.JavaName}(new Short(key));
  +        set${col.JavaName}(new Short(key));
       #elseif($cjtype == "Integer")
  -            set${col.JavaName}(new Integer(key));
  +        set${col.JavaName}(new Integer(key));
       #elseif($cjtype == "Long")
  -            set${col.JavaName}(new Long(key));
  +        set${col.JavaName}(new Long(key));
       #elseif($cjtype == "Byte") )
  -            set${col.JavaName}(new Byte(key));
  +        set${col.JavaName}(new Byte(key));
       #elseif($cjtype == "Float")
  -            set${col.JavaName}(new Float(key));
  +        set${col.JavaName}(new Float(key));
       #elseif($cjtype == "Double")
  -            set${col.JavaName}(new Double(key));
  +        set${col.JavaName}(new Double(key));
       #elseif($cjtype == "String")
  -            set${col.JavaName}(key);
  +        set${col.JavaName}(key);
       #elseif($cjtype == "Date")
  -            set${col.JavaName}(new Date(key));
  +        set${col.JavaName}(new Date(key));
       #else
  -            set${col.JavaName}(new ${cjtype}(key));
  +        set${col.JavaName}(new ${cjtype}(key));
       #end
       }
   
  @@ -1241,41 +1238,41 @@
        */
       public void setPrimaryKey(ObjectKey key) throws TorqueException
       {
  -         SimpleKey[] keys = (SimpleKey[]) key.getValue();
  +        SimpleKey[] keys = (SimpleKey[]) key.getValue();
           SimpleKey tmpKey = null;
       #set ($i = 0)
       #foreach ($pk in $table.PrimaryKey)
         #set ($pktype = $pk.JavaNative)
         #if ($pktype == "short")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).shortValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).shortValue());
         #elseif($pktype == "int")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).intValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).intValue());
         #elseif($pktype == "long")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).longValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).longValue());
         #elseif($pktype == "BigDecimal")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).getBigDecimal());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).getBigDecimal());
         #elseif($pktype == "byte") )
  -            set${pk.JavaName}(((NumberKey)keys[$i]).byteValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).byteValue());
         #elseif($pktype == "float")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).floatValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).floatValue());
         #elseif($pktype == "double")
  -            set${pk.JavaName}(((NumberKey)keys[$i]).doubleValue());
  +        set${pk.JavaName}(((NumberKey)keys[$i]).doubleValue());
         #elseif($pktype == "Short")
  -            set${pk.JavaName}(new Short(((NumberKey)keys[$i]).shortValue()));
  +        set${pk.JavaName}(new Short(((NumberKey)keys[$i]).shortValue()));
         #elseif($pktype == "Integer")
  -            set${pk.JavaName}(new Integer(((NumberKey)keys[$i]).intValue()));
  +        set${pk.JavaName}(new Integer(((NumberKey)keys[$i]).intValue()));
         #elseif($pktype == "Long")
  -            set${pk.JavaName}(new Long(((NumberKey)keys[$i]).longValue()));
  +        set${pk.JavaName}(new Long(((NumberKey)keys[$i]).longValue()));
         #elseif($pktype == "Byte") )
  -            set${pk.JavaName}(new Byte(((NumberKey)keys[$i]).byteValue()));
  +        set${pk.JavaName}(new Byte(((NumberKey)keys[$i]).byteValue()));
         #elseif($pktype == "Float")
  -            set${pk.JavaName}(new Float(((NumberKey)keys[$i]).floatValue()));
  +        set${pk.JavaName}(new Float(((NumberKey)keys[$i]).floatValue()));
         #elseif($pktype == "Double")
  -            set${pk.JavaName}(new Double(((NumberKey)keys[$i]).doubleValue()));
  +        set${pk.JavaName}(new Double(((NumberKey)keys[$i]).doubleValue()));
         #elseif($pktype == "String")
  -            set${pk.JavaName}(keys[$i].toString());
  +        set${pk.JavaName}(keys[$i].toString());
         #elseif($pktype == "Date")
  -            set${pk.JavaName}(((DateKey)keys[$i]).getDate());
  +        set${pk.JavaName}(((DateKey)keys[$i]).getDate());
         #end
         #set ( $i = $i + 1 )
       #end
  @@ -1291,9 +1288,10 @@
       #end
        */
       public void setPrimaryKey($argList)
  -        $throwsClause {
  +        $throwsClause 
  +    {
       #foreach ($col in $table.PrimaryKey)
  -         set${col.JavaName}($col.UncapitalisedJavaName);
  +        set${col.JavaName}($col.UncapitalisedJavaName);
       #end
       }
   
  
  
  

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


Mime
View raw message