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/06/29 21:00:21 UTC

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

jmcnally    01/06/29 12:00:21

  Modified:    conf/torque/templates/om Object.vm Peer.vm
  Log:
  fix to get table Objects (OMs) that extend other torque objects to compile.
  this could use some review later as there is probably a cleaner way to solve
  the problem.
  
  Revision  Changes    Path
  1.61      +6 -1      jakarta-turbine/conf/torque/templates/om/Object.vm
  
  Index: Object.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/Object.vm,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- Object.vm	2001/06/25 05:19:59	1.60
  +++ Object.vm	2001/06/29 19:00:18	1.61
  @@ -251,7 +251,12 @@
       {
           if ( $varName==null && ($conditional) )
           {
  -            $varName = ${className}Peer.retrieveByPK($arglist);
  +  #if ($tblFK.isAlias())
  +        $varName = ${className}Peer.retrieve${className}ByPK($arglist);
  +  #else
  +        $varName = ${className}Peer.retrieveByPK($arglist);
  +  #end
  +
               // The following can be used instead of the line above to
               // guarantee the related object contains a reference
               // to this object, but this level of coupling 
  
  
  
  1.65      +15 -7     jakarta-turbine/conf/torque/templates/om/Peer.vm
  
  Index: Peer.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/conf/torque/templates/om/Peer.vm,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Peer.vm	2001/06/29 01:51:57	1.64
  +++ Peer.vm	2001/06/29 19:00:19	1.65
  @@ -38,7 +38,7 @@
   #if (!$table.isAlias())
   
       /** the mapbuilder for this class */
  -    private static final ${table.JavaName}MapBuilder mapBuilder = 
  +    protected static final ${table.JavaName}MapBuilder mapBuilder = 
           (${table.JavaName}MapBuilder)getMapBuilder(${table.JavaName}MapBuilder.CLASS_NAME);
   
       /** the table name for this class */
  @@ -847,12 +847,21 @@
           return criteria;
       }
   
  +#end ## ends if (!$table.isAlias())
  +
  +
  +#if ($table.isAlias())
  +    #set ($retrieveMethod = "retrieve${table.JavaName}ByPK")
  +#else
  +    #set ($retrieveMethod = "retrieveByPK")
  +#end
  +
       /** 
        * Retrieve a single object by pk
        *
        * @param ObjectKey pk
        */
  -    public static $table.JavaName retrieveByPK( ObjectKey pk )
  +    public static $table.JavaName ${retrieveMethod}( ObjectKey pk )
           throws Exception
       {
           DBConnection db = null;
  @@ -860,7 +869,7 @@
          try
           {
              db = TurbineDB.getConnection( mapBuilder.getDatabaseMap().getName() );
  -           retVal = retrieveByPK( pk, db );
  +           retVal = ${retrieveMethod}( pk, db );
           }
           finally
           {
  @@ -876,7 +885,7 @@
        * @param ObjectKey pk
        * @param DBConnection dbcon
        */
  -    public static $table.JavaName retrieveByPK( ObjectKey pk, DBConnection dbcon )
  +    public static $table.JavaName ${retrieveMethod}( ObjectKey pk, DBConnection dbcon )
           throws Exception
       {
   
  @@ -915,7 +924,7 @@
        * @param $cjtype $clo
   #end
        */
  -    public static $table.JavaName retrieveByPK(
  +    public static $table.JavaName ${retrieveMethod}(
   #foreach ($col in $table.PrimaryKeys)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype = $col.JavaNative )
  @@ -957,7 +966,7 @@
   #end
        * @param DBConnection dbcon
        */
  -    public static $table.JavaName retrieveByPK(
  +    public static $table.JavaName ${retrieveMethod}(
   #foreach ($col in $table.PrimaryKeys)
       #set ( $clo=$col.Name.toLowerCase() )
       #set ( $cjtype = $col.JavaNative )
  @@ -985,7 +994,6 @@
       }
   #end
   
  -#end ## ends if (!$table.isAlias())
   
   #if ($complexObjectModel)
   
  
  
  

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