db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1103171 [3/4] - in /db/torque/torque4/trunk: torque-runtime/src/main/java/org/apache/torque/util/ torque-runtime/src/test/java/org/apache/torque/sql/ torque-runtime/src/test/java/org/apache/torque/util/ torque-templates/src/main/java/org/a...
Date Sat, 14 May 2011 17:34:25 GMT
Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplGetter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplGetter.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplGetter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplGetter.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,45 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the getter for the peer implementation. 
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+##
+    /**
+     * Returns an instance of the implementation of the peer.
+     * If no instance is currently cached, a new instance is created and cached.
+     *
+     * @return an instance of the implementation of the peer, not null.
+     */
+    protected static ${peerImplClassName} ${peerImplGetter}()
+    {
+        ${peerImplClassName} peerImplInstance = ${peerImplFieldName};
+        if (peerImplInstance == null)
+        {
+            peerImplInstance = create${peerImplClassName}();
+            ${peerImplFieldName} = peerImplInstance;
+        }
+        return peerImplInstance;
+    }
+
+

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplSetter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplSetter.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplSetter.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplSetter.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,38 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the setter for the peer implementation. 
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+##
+    /**
+     * Sets the instance of the implementation of the peer.
+     *
+     * @param an instance of the implementation of the peer, or null
+     *        if a new instance should be created automatically.
+     */
+    public static void ${peerImplSetter}(${peerImplClassName} peerImplInstance)
+    {
+        ${peerImplFieldName} = peerImplInstance;
+    }
+

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm Sat May 14 17:34:23 2011
@@ -37,22 +37,8 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> resultSet2Objects(java.sql.ResultSet resultSet)
+    public static List<${dbObjectClassName}> resultSet2Objects(ResultSet resultSet)
             throws TorqueException
     {
-        try
-        {
-            $recordMapperClass mapper = new ${recordMapperClass}();
-            List<${dbObjectClassName}> result
-                    = new ArrayList<${dbObjectClassName}>();
-            while (resultSet.next())
-            {
-                result.add(mapper.processRow(resultSet, 0));
-            }
-            return result;
-        }
-        catch (SQLException e)
-        {
-            throw new TorqueException(e);
-        }
+        return ${peerImplGetter}().resultSet2Objects(resultSet);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm Sat May 14 17:34:23 2011
@@ -44,7 +44,7 @@
     public static $dbObjectClassName retrieveByPK($columnFieldType pk)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk));
+        return ${peerImplGetter}().retrieveByPK(pk);
     }
 
     /**
@@ -60,7 +60,7 @@
     public static $dbObjectClassName retrieveByPK($columnFieldType pk, Connection con)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk), con);
+        return ${peerImplGetter}().retrieveByPK(pk, con);
     }
     
     
@@ -86,23 +86,14 @@
     #end
         throws TorqueException
     {
-        Connection db = null;
-        $dbObjectClassName retVal = null;
-        try
-        {
-           db = Torque.getConnection(DATABASE_NAME);
-           retVal = retrieveByPK(
+        return ${peerImplGetter}().retrieveByPK(
+    #set ( $elementCount = 1 )
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
-               ${columnField},
+                $columnField#if($elementCount != $primaryKeyColumnElements.size()),#else);#end
+
+      #set ( $elementCount = $elementCount + 1 )
     #end
-               db);
-        }
-        finally
-        {
-            Torque.closeConnection(db);
-        }
-        return retVal;
     }
 
     /**
@@ -123,22 +114,12 @@
     #end
             Connection con) throws TorqueException
     {
-
-        Criteria criteria = new Criteria(5);
+        return ${peerImplGetter}().retrieveByPK(
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
-      #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-        criteria.add($peerColumnName, $columnField);
+                ${columnField},
     #end
-        List<${dbObjectClassName}> v = doSelect(criteria, con);
-        if (v.size() == 1)
-        {
-            return v.get(0);
-        }
-        else
-        {
-            throw new TorqueException("Failed to select one and only one row.");
-        }
+                con);
     }
   #end
 
@@ -154,18 +135,7 @@
     public static $dbObjectClassName retrieveByPK(ObjectKey pk)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        Connection db = null;
-        $dbObjectClassName retVal;
-        try
-        {
-            db = Torque.getConnection(DATABASE_NAME);
-            retVal = ${peerClassName}.retrieveByPK(pk, db);
-        }
-        finally
-        {
-            Torque.closeConnection(db);
-        }
-        return retVal;
+        return ${peerImplGetter}().retrieveByPK(pk);
     }
 
     /**
@@ -181,20 +151,7 @@
     public static $dbObjectClassName retrieveByPK(ObjectKey pk, Connection con)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        Criteria criteria = buildCriteria(pk);
-        List<${dbObjectClassName}> v = ${peerClassName}.doSelect(criteria, con);
-        if (v.size() == 0)
-        {
-            throw new NoRowsException("Failed to select a row.");
-        }
-        else if (v.size() > 1)
-        {
-            throw new TooManyRowsException("Failed to select only one row.");
-        }
-        else
-        {
-            return ($dbObjectClassName)v.get(0);
-        }
+        return ${peerImplGetter}().retrieveByPK(pk, con);
     }
 
 #end
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm Sat May 14 17:34:23 2011
@@ -39,65 +39,21 @@
     public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks)
         throws TorqueException
     {
-        Connection db = null;
-        List<${dbObjectClassName}> retVal = null;
-        try
-        {
-           db = Torque.getConnection(DATABASE_NAME);
-           retVal = ${peerClassName}.retrieveByPKs(pks, db);
-        }
-        finally
-        {
-            Torque.closeConnection(db);
-        }
-        return retVal;
+        return ${peerImplGetter}().retrieveByPKs(pks);
     }
 
     /**
      * Retrieve multiple objects by pk
      *
      * @param pks List of primary keys
-     * @param dbcon the connection to use
+     * @param con the connection to use
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks, Connection dbcon)
+    public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks, Connection con)
         throws TorqueException
     {
-        List<${dbObjectClassName}> objs = null;
-        if (pks == null || pks.size() == 0)
-        {
-            objs = new LinkedList<${dbObjectClassName}>();
-        }
-        else
-        {
-            Criteria criteria = new Criteria();
-  #set ( $columnElement = $primaryKeyColumnElements.get(0) )
-  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName"))
-  #if ($primaryKeyColumnElements.size() == 1)
-            criteria.addIn(${peerClassName}.$peerColumnName, pks);
-  #else
-            Iterator<ObjectKey> iter = pks.iterator();
-            while (iter.hasNext())
-            {
-                ObjectKey pk = iter.next();
-                SimpleKey[] keys = (SimpleKey[])pk.getValue();
-    #set ( $i = 0 )
-    #foreach ($primaryKeyColumnElement in $primaryKeyColumnElements)
-                    Criteria.Criterion c$i = criteria.getNewCriterion(
-                        ${peerClassName}.$peerColumnName, keys[$i], Criteria.EQUAL);
-      #set ( $j = $i - 1 )
-      #if ($i > 0)
-                        c${j}.and(c${i});
-      #end
-      #set ( $i = $i + 1 )
-    #end
-                criteria.or(c0);
-            }
-  #end
-            objs = ${peerClassName}.doSelect(criteria, dbcon);
-        }
-        return objs;
+        return ${peerImplGetter}().retrieveByPKs(pks,con);
     }
 
 #end
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/classJavadoc.vm Sat May 14 17:34:23 2011
@@ -34,7 +34,7 @@
  * [${torqueGen.now()}]
  *
 #end
- * You should add additional methods to this class to meet the
- * application requirements.  This class will only be generated as
- * long as it does not already exist in the output directory.
+ * This class provides static wrappers for the peer implementation classes.
+ * This class will only be generated as long as it does not already exist
+ * in the output directory.
  */

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/addSelectColumns.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/addSelectColumns.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/addSelectColumns.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/addSelectColumns.vm Sat May 14 17:34:23 2011
@@ -34,11 +34,11 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void addSelectColumns(Criteria criteria)
+    public void addSelectColumns(Criteria criteria)
             throws TorqueException
     {
 #foreach ($columnElement in $torqueGen.getChildren("column"))
   #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName"))
-        criteria.addSelectColumn(${peerClassName}.$peerColumnName);
+        criteria.addSelectColumn(${peerClassName}.${peerColumnName});
 #end
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/basePeerImpl.vm Sat May 14 17:34:23 2011
@@ -32,24 +32,16 @@ package ${basePeerPackage};
 $torqueGen.mergepoint("imports")
 
 $torqueGen.mergepoint("classJavadoc")
-public abstract class $basePeerClassName
-    extends ${basePeerBaseClass}
+public abstract class $basePeerImplClassName
+#if (${basePeerImplBaseClass} && ${basePeerImplBaseClass} !="")
+    extends ${basePeerImplBaseClass}
+#end
 {
-$torqueGen.mergepoint("serialVersionUid")
-
-$torqueGen.mergepoint("tableDatabaseNameConstants")
-
-$torqueGen.mergepoint("columnConstants")
+$torqueGen.mergepoint("log")
 
-$torqueGen.mergepoint("staticInit")
+$torqueGen.mergepoint("serialVersionUid")
 
 $torqueGen.mergepoint("mapBuilderGetter")
-
-$torqueGen.mergepoint("numColumnConstant")
-
-$torqueGen.mergepoint("dbObjectClassConstants")
-
-$torqueGen.mergepoint("classMethods")
 $torqueGen.mergepoint("resultSet2Objects")
 $torqueGen.mergepoint("addSelectColumns")
 $torqueGen.mergepoint("correctBooleans")

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm (from r1062315, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm&r1=1062315&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm Sat May 14 17:34:23 2011
@@ -33,7 +33,7 @@
      * @throws TorqueException if the table map cannot be retrieved
      *         (should not happen).
      */
-    public static ColumnValues buildColumnValues($dbObjectClassName $field)
+    public ColumnValues buildColumnValues($dbObjectClassName $field)
             throws TorqueException
     {
         ColumnValues columnValues = new ColumnValues(getTableMap());

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildCriteria.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildCriteria.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildCriteria.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildCriteria.vm Sat May 14 17:34:23 2011
@@ -33,7 +33,7 @@
      *
      * @param pk the primary key value to build the criteria from, not null.
      */
-    public static Criteria buildCriteria(ObjectKey pk)
+    public Criteria buildCriteria(ObjectKey pk)
     {
         Criteria criteria = new Criteria();
 #set ( $primaryKeyColumnElements = $torqueGen.getChild("primary-keys").getChildren("column") )
@@ -62,9 +62,9 @@
      *
      * @param obj the object to build the criteria from, not null.
      */
-    public static Criteria buildCriteria($dbObjectClassName obj)
+    public Criteria buildCriteria($dbObjectClassName obj)
     {
-        Criteria criteria = new Criteria(DATABASE_NAME);
+        Criteria criteria = new Criteria(${peerClassName}.DATABASE_NAME);
 #foreach ($columnElement in $torqueGen.getChildren("column"))
   #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
   #set ( $getter = $columnElement.getAttribute("getter") )

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildSelectCriteria.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildSelectCriteria.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildSelectCriteria.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildSelectCriteria.vm Sat May 14 17:34:23 2011
@@ -37,9 +37,9 @@
      *
      * @param obj the object to build the criteria from, not null.
      */
-    public static Criteria buildSelectCriteria($dbObjectClassName obj)
+    public Criteria buildSelectCriteria($dbObjectClassName obj)
     {
-        Criteria criteria = new Criteria(DATABASE_NAME);
+        Criteria criteria = new Criteria(${peerClassName}.DATABASE_NAME);
 #foreach ($columnElement in $torqueGen.getChildren("column"))
   #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") ) 
   #set ( $columnFieldType = $columnElement.getAttribute("fieldType") ) 

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/correctBooleans.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/correctBooleans.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/correctBooleans.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/correctBooleans.vm Sat May 14 17:34:23 2011
@@ -36,7 +36,7 @@
      * @throws TorqueException if the database map for the criteria cannot be 
                obtained.
      */
-    public static void correctBooleans(Criteria criteria) throws TorqueException
+    public void correctBooleans(Criteria criteria) throws TorqueException
     {
-        ${peerClassName}.correctBooleans(criteria, getTableMap());
+        correctBooleans(criteria, getTableMap());
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm (from r1098715, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm&r1=1098715&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm Sat May 14 17:34:23 2011
@@ -34,15 +34,15 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-     public static void doDelete(Criteria criteria) throws TorqueException
+     public void doDelete(Criteria criteria) throws TorqueException
      {
         Connection connection = null;
         try
         {
             connection = Transaction.beginOptional(
-                    DATABASE_NAME,
+                    ${peerClassName}.DATABASE_NAME,
                     true);
-            ${peerClassName}.doDelete(criteria, connection);
+            doDelete(criteria, connection);
             Transaction.commit(connection);
             connection = null;
         }
@@ -65,14 +65,14 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-     public static void doDelete(Criteria criteria, Connection con)
+     public void doDelete(Criteria criteria, Connection con)
         throws TorqueException
      {
-        ${peerClassName}.correctBooleans(criteria);
+        correctBooleans(criteria);
 
         setDbName(criteria);
 
-        BasePeer.doDelete(criteria, TABLE_NAME, con);
+        doDelete(criteria, ${peerClassName}.TABLE_NAME, con);
      }
 
     /**
@@ -80,11 +80,10 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doDelete($dbObjectClassName obj) throws TorqueException
+    public void doDelete($dbObjectClassName obj) throws TorqueException
     {
         ## TODO use buildSelectCriteria if no pk is present
-        ${peerClassName}.doDelete(
-            ${peerClassName}.buildCriteria(obj.getPrimaryKey()));
+        doDelete(buildCriteria(obj.getPrimaryKey()));
     }
 
     /**
@@ -97,12 +96,11 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doDelete($dbObjectClassName obj, Connection con)
+    public void doDelete($dbObjectClassName obj, Connection con)
         throws TorqueException
     {
         ## TODO use buildSelectCriteria if no pk is present
-        ${peerClassName}.doDelete(
-            ${peerClassName}.buildCriteria(obj.getPrimaryKey()), con);
+        doDelete(buildCriteria(obj.getPrimaryKey()), con);
     }
 
     /**
@@ -112,9 +110,9 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doDelete(ObjectKey pk) throws TorqueException
+    public void doDelete(ObjectKey pk) throws TorqueException
     {
-        ${peerClassName}.doDelete(pk, (Connection) null);
+        doDelete(pk, (Connection) null);
     }
 
     /**
@@ -127,8 +125,8 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doDelete(ObjectKey pk, Connection con)
+    public void doDelete(ObjectKey pk, Connection con)
         throws TorqueException
     {
-        ${peerClassName}.doDelete(${peerClassName}.buildCriteria(pk), con);
+        doDelete(buildCriteria(pk), con);
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doInsert.vm (from r1062315, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doInsert.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doInsert.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm&r1=1062315&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doInsert.vm Sat May 14 17:34:23 2011
@@ -33,13 +33,12 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doInsert($dbObjectClassName obj) throws TorqueException
+    public void doInsert($dbObjectClassName obj) throws TorqueException
     {
   #if ($idMethod.equals("none") || $torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        ${peerClassName}.doInsert(${peerClassName}.buildColumnValues(obj));
+        doInsert(buildColumnValues(obj));
   #else
-        obj.setPrimaryKey(${peerClassName}.doInsert(
-                ${peerClassName}.buildColumnValues(obj)));
+        obj.setPrimaryKey(doInsert(buildColumnValues(obj)));
   #end
         obj.setNew(false);
         obj.setModified(false);
@@ -55,14 +54,13 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static void doInsert($dbObjectClassName obj, Connection con)
+    public void doInsert($dbObjectClassName obj, Connection con)
         throws TorqueException
     {
   #if ($idMethod.equals("none") || $torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        ${peerClassName}.doInsert(${peerClassName}.buildColumnValues(obj), con);
+        doInsert(buildColumnValues(obj), con);
   #else
-        ObjectKey primaryKey = ${peerClassName}.doInsert(
-                ${peerClassName}.buildColumnValues(obj), con);
+        ObjectKey primaryKey = doInsert(buildColumnValues(obj), con);
         if (primaryKey != null)
         {
             obj.setPrimaryKey(primaryKey);

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm Sat May 14 17:34:23 2011
@@ -35,18 +35,18 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> doSelect(Criteria criteria)
+    public List<${dbObjectClassName}> doSelect(Criteria criteria)
             throws TorqueException
     {
         if (criteria.getSelectColumns().size() == 0)
         {
-            ${peerClassName}.addSelectColumns(criteria);
+            addSelectColumns(criteria);
         }
         setDbName(criteria);
 
-        return ${peerClassName}.doSelect(
+        return doSelect(
             criteria, 
-            new $recordMapperClass(),
+            new $recordMapperClassName(),
             getTableMap());
     }
 
@@ -60,20 +60,20 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> doSelect(
+    public List<${dbObjectClassName}> doSelect(
                 Criteria criteria,
                 Connection connection)
             throws TorqueException
     {
         if (criteria.getSelectColumns().size() == 0)
         {
-            ${peerClassName}.addSelectColumns(criteria);
+            addSelectColumns(criteria);
         }
         setDbName(criteria);
 
-        return ${peerClassName}.doSelect(
+        return doSelect(
                 criteria,
-                new $recordMapperClass(),
+                new $recordMapperClassName(),
                 getTableMap(),
                 connection);
     }
@@ -85,9 +85,8 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> doSelect($dbObjectClassName obj)
+    public List<${dbObjectClassName}> doSelect($dbObjectClassName obj)
             throws TorqueException
     {
-        return ${peerClassName}.doSelect(
-            ${peerClassName}.buildSelectCriteria(obj));
+        return doSelect(buildSelectCriteria(obj));
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm (from r1098717, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm&r1=1098717&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm Sat May 14 17:34:23 2011
@@ -34,11 +34,14 @@
 #set ( $joinedDbObjectPackage = $joinedTableElement.getAttribute("dbObjectPackage") )
 #set ( $joinedDbObject = "${joinedDbObjectPackage}.$joinedDbObjectClassName" )
 #set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
-#set ( $recordMapperClass = $tableElement.getAttribute("recordMapperClass") )
+#set ( $peerImplClassName = $tableElement.getAttribute("peerImplClassName") )
+#set ( $recordMapperClassName = $tableElement.getAttribute("recordMapperClassName") )
 #set ( $joinedPeerClassName = $joinedTableElement.getAttribute("peerClassName") )
-#set ( $joinedPeerMapperName = $joinedTableElement.getAttribute("recordMapperClass") )
+#set ( $joinedPeerImplClassName = $joinedTableElement.getAttribute("peerImplClassName") )
+#set ( $joinedRecordMapperClassName = $joinedTableElement.getAttribute("recordMapperClassName") )
 #set ( $joinedPeerPackage = $joinedTableElement.getAttribute("peerPackage") )
 #set ( $joinedPeer = "${joinedPeerPackage}.$joinedPeerClassName" )
+#set ( $joinedPeerImpl = "${joinedPeerPackage}.$joinedPeerImplClassName" )
 #set ( $referenceElements = $foreignKeyElement.getChildren("reference") )
 #set ( $localFieldElement = $foreignKeyElement.getChild("local-field"))
 #set ( $getterForJoinedDbObject = $localFieldElement.getAttribute("getter"))
@@ -49,14 +52,14 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> ${peerJoinSelectMethod}(Criteria criteria)
+    public List<${dbObjectClassName}> ${peerJoinSelectMethod}(Criteria criteria)
         throws TorqueException
     {
         Connection connection = null;
         try
         {
             connection = Transaction.beginOptional(
-                    DATABASE_NAME,
+                    ${peerClassName}.DATABASE_NAME,
                     true);
             List<${dbObjectClassName}> result
                     = $peerClassName.${peerJoinSelectMethod}(criteria, connection);
@@ -80,32 +83,36 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<$dbObjectClassName> ${peerJoinSelectMethod}(
+    public List<$dbObjectClassName> ${peerJoinSelectMethod}(
             Criteria criteria, Connection conn)
         throws TorqueException
     {
         setDbName(criteria);
 
-        ${peerClassName}.addSelectColumns(criteria);
+        addSelectColumns(criteria);
         ${joinedPeer}.addSelectColumns(criteria);
 
         CompositeMapper compositeMapper = new CompositeMapper();
-        compositeMapper.addMapper(new ${peerClassName}.${recordMapperClass}(), 0);
-        compositeMapper.addMapper(new ${joinedPeer}.$joinedPeerMapperName(), numColumns);
+        compositeMapper.addMapper(
+                new ${recordMapperClassName}(),
+                0);
+        compositeMapper.addMapper(
+                new ${joinedRecordMapperClassName}(),
+                ${peerClassName}.numColumns);
   #foreach ($referenceElement in $referenceElements)
     #set ( $joinedColumnElement = $referenceElement.getChild("foreign-column").getChild("column") )
     #set ( $joinedPeerColumnName = $joinedColumnElement.getAttribute("peerColumnName") )
     #set ( $columnElement = $referenceElement.getChild("local-column").getChild("column") )
     #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
         criteria.addJoin($peerClassName.$peerColumnName,
-            $joinedPeer.$joinedPeerColumnName);
+            ${joinedPeer}.$joinedPeerColumnName);
   #end
 
         correctBooleans(criteria);
 
         List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>();
-        List<List<Object>> rawResult = ${peerClassName}.doSelect(
-                criteria, compositeMapper, ${peerClassName}.getTableMap(), conn);
+        List<List<Object>> rawResult = doSelect(
+                criteria, compositeMapper, getTableMap(), conn);
         for (List<Object> rawResultRow : rawResult)
         {
             $dbObjectClassName obj1 = ($dbObjectClassName) rawResultRow.get(0);

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm Sat May 14 17:34:23 2011
@@ -33,9 +33,10 @@
   #set ( $tableName = $tableElement.getAttribute("name") )
   #set ( $excludeTableElement = $foreignKeyElement.getChild("table") )
   #set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
+  #set ( $peerImplClassName = $tableElement.getAttribute("peerImplClassName") )
   #set ( $tableField = $tableElement.getAttribute("field") )
   #set ( $peerPackage = $tableElement.getAttribute("peerPackage") )
-  #set ( $recordMapperClass = $tableElement.getAttribute("recordMapperClass") )
+  #set ( $recordMapperClassName = $tableElement.getAttribute("recordMapperClassName") )
   #set ( $dbObjectClassName = $tableElement.getAttribute("dbObjectClassName") )
   #set ( $dbObjectPackage = $tableElement.getAttribute("dbObjectPackage") )
   #set ( $dbObject = "${dbObjectPackage}.$dbObjectClassName" )
@@ -45,19 +46,19 @@
      *
      * This method is protected by default in order to keep the public
      * api reasonable.  You can provide public methods for those you
-     * actually need in ${peerClassName}.
+     * actually need in ${peerImplClassName}.
      *
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria)
+    protected List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria)
         throws TorqueException
     {
         Connection connection = null;
         try
         {
             connection = Transaction.beginOptional(
-                    DATABASE_NAME,
+                    ${peerClassName}.DATABASE_NAME,
                     true);
             List<${dbObjectClassName}> result
                     = $peerClassName.${peerJoinAllExceptSelectMethod}(criteria, connection);
@@ -80,20 +81,20 @@
      *
      * This method is protected by default in order to keep the public
      * api reasonable.  You can provide public methods for those you
-     * actually need in ${peerClassName}.
+     * actually need in ${peerImplClassName}.
      *
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria, Connection conn)
+    protected List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria, Connection conn)
         throws TorqueException
     {
         setDbName(criteria);
 
         CompositeMapper compositeMapper = new CompositeMapper();
-        compositeMapper.addMapper(new ${peerClassName}.${recordMapperClass}(), 0);
+        compositeMapper.addMapper(new ${recordMapperClassName}(), 0);
         ${peerClassName}.addSelectColumns(criteria);
-        int offset = numColumns;
+        int offset = ${peerClassName}.numColumns;
   #foreach ($joinedForeignKeyElement in $foreignKeyElements)
     #if ($joinedForeignKeyElement != $foreignKeyElement)
       #set ( $joinedTableElement = $joinedForeignKeyElement.getChild("table"))
@@ -101,9 +102,11 @@
       ## want to cover this case, but the code is not there yet.
       #if ( $joinedTableName != $tableName )
         #set ( $joinedPeerClassName = $joinedTableElement.getAttribute("peerClassName") )
+        #set ( $joinedPeerImplClassName = $joinedTableElement.getAttribute("peerImplClassName") )
         #set ( $joinedPeerPackage = $joinedTableElement.getAttribute("peerPackage") )
         #set ( $joinedPeer = "${joinedPeerPackage}.${joinedPeerClassName}" )
-        #set ( $joinedPeerMapperName = $joinedTableElement.getAttribute("recordMapperClass") )
+        #set ( $joinedPeerImpl = "${joinedPeerPackage}.${joinedPeerImplClassName}" )
+        #set ( $joinedRecordMapperClassName = $joinedTableElement.getAttribute("recordMapperClassName") )
         #set ( $referenceElements = $joinedForeignKeyElement.getChildren("reference") )
  
         ${joinedPeer}.addSelectColumns(criteria);
@@ -114,7 +117,7 @@
           #set ( $joinedPeerColumnName = $joinedColumnElement.getAttribute("peerColumnName") )
         criteria.addJoin(${peerClassName}.$peerColumnName, ${joinedPeer}.$joinedPeerColumnName);
         #end
-        compositeMapper.addMapper(new ${joinedPeer}.$joinedPeerMapperName(), offset);
+        compositeMapper.addMapper(new ${joinedRecordMapperClassName}(), offset);
         offset = offset + ${joinedPeer}.numColumns;
       #end
     #end
@@ -123,8 +126,8 @@
         correctBooleans(criteria);
 
         List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>();
-        List<List<Object>> rawResult = ${peerClassName}.doSelect(
-                criteria, compositeMapper, ${peerClassName}.getTableMap(), conn);
+        List<List<Object>> rawResult = doSelect(
+                criteria, compositeMapper, getTableMap(), conn);
         for (List<Object> rawResultRow : rawResult)
         {
             $dbObjectClassName $tableField = ($dbObjectClassName) rawResultRow.get(0);

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doUpdate.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doUpdate.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doUpdate.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doUpdate.vm Sat May 14 17:34:23 2011
@@ -35,15 +35,15 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static int doUpdate(ColumnValues columnValues) throws TorqueException
+    public int doUpdate(ColumnValues columnValues) throws TorqueException
     {
         Connection connection = null;
         try
         {
             connection = Transaction.beginOptional(
-                    DATABASE_NAME,
+                    ${peerClassName}.DATABASE_NAME,
                     true);
-            int result = ${peerClassName}.doUpdate(columnValues, connection);
+            int result = doUpdate(columnValues, connection);
             Transaction.commit(connection);
             connection = null;
             return result;
@@ -71,11 +71,12 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static int doUpdate(ColumnValues columnValues, Connection con)
+    public int doUpdate(ColumnValues columnValues, Connection con)
         throws TorqueException
     {
-        Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
-        ${peerClassName}.correctBooleans(columnValues);
+        Criteria selectCriteria 
+                = new Criteria(${peerClassName}.DATABASE_NAME, 2);
+        correctBooleans(columnValues);
 
 #foreach ($columnElement in $torqueGen.getChildren("column"))
 
@@ -83,11 +84,11 @@
     #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
     
         selectCriteria.put(
-                ${peerClassName}.$peerColumnName,
-                columnValues.remove(${peerClassName}.$peerColumnName).getValue());
+                ${peerClassName}.${peerColumnName},
+                columnValues.remove(${peerClassName}.${peerColumnName}).getValue());
   #end
 #end
-        return BasePeer.doUpdate(selectCriteria, columnValues, con);
+        return doUpdate(selectCriteria, columnValues, con);
     }
 
     /**
@@ -101,14 +102,14 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static int doUpdate($dbObjectClassName obj) throws TorqueException
+    public int doUpdate($dbObjectClassName obj) throws TorqueException
     {
 #if ($torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
         throw new TorqueException(
                 "doUpdate does not work for objects without primary key");
 #else
-        ColumnValues columnValues = ${peerClassName}.buildColumnValues(obj);
-        int result = ${peerClassName}.doUpdate(columnValues);
+        ColumnValues columnValues = buildColumnValues(obj);
+        int result = doUpdate(columnValues);
         obj.setModified(false);
         return result;
 #end
@@ -126,15 +127,15 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static int doUpdate($dbObjectClassName obj, Connection con)
+    public int doUpdate($dbObjectClassName obj, Connection con)
         throws TorqueException
     {
   #if ($torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
         throw new TorqueException(
                 "doUpdate does not work for objects without primary key");
   #else
-        ColumnValues columnValues = ${peerClassName}.buildColumnValues(obj);
-        int result = ${peerClassName}.doUpdate(columnValues, con);
+        ColumnValues columnValues = buildColumnValues(obj);
+        int result = doUpdate(columnValues, con);
         obj.setModified(false);
         return result;
   #end

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getOMClass.vm (from r1070070, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getOMClass.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getOMClass.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm&r1=1070070&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getOMClass.vm Sat May 14 17:34:23 2011
@@ -35,7 +35,7 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static Class<?> getOMClass()
+    public Class<?> getOMClass()
         throws TorqueException
     {
 #if ($abstract == "true")

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getTableMap.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getTableMap.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getTableMap.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/getTableMap.vm Sat May 14 17:34:23 2011
@@ -31,5 +31,6 @@
     public static TableMap getTableMap()
         throws TorqueException
     {
-        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
+        return Torque.getDatabaseMap(${peerClassName}.DATABASE_NAME)
+                .getTable(${peerClassName}.TABLE_NAME);
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm (from r1070071, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm&r1=1070071&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm Sat May 14 17:34:23 2011
@@ -47,6 +47,8 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.torque.NoRowsException;
 import org.apache.torque.TooManyRowsException;
 import org.apache.torque.Torque;
@@ -70,4 +72,7 @@ import org.apache.torque.util.JdbcTypedV
 import ${mapBuilderPackage}.*;
 #if ($basePeerPackage != $dbObjectPackage)
 import ${dbObjectPackage}.*;
+#end
+#if ($basePeerPackage != $recordMapperPackage)
+import ${recordMapperPackage}.*;
 #end
\ No newline at end of file

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/log.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/log.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/log.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/log.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,31 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the base peer class.
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.  
+##
+    /** The class log. */
+    private static Log log = LogFactory.getLog(${basePeerImplClassName}.class);
\ No newline at end of file

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/resultSet2Objects.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/resultSet2Objects.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/resultSet2Objects.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/resultSet2Objects.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/resultSet2Objects.vm Sat May 14 17:34:23 2011
@@ -37,12 +37,12 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> resultSet2Objects(java.sql.ResultSet resultSet)
+    public List<${dbObjectClassName}> resultSet2Objects(java.sql.ResultSet resultSet)
             throws TorqueException
     {
         try
         {
-            $recordMapperClass mapper = new ${recordMapperClass}();
+            $recordMapperClassName mapper = new ${recordMapperClassName}();
             List<${dbObjectClassName}> result
                     = new ArrayList<${dbObjectClassName}>();
             while (resultSet.next())

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPK.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPK.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPK.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPK.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPK.vm Sat May 14 17:34:23 2011
@@ -41,10 +41,10 @@
      * @throws NoRowsException Primary key was not found in database.
      * @throws TooManyRowsException Primary key was not found in database.
      */
-    public static $dbObjectClassName retrieveByPK($columnFieldType pk)
+    public $dbObjectClassName retrieveByPK($columnFieldType pk)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk));
+        return retrieveByPK(SimpleKey.keyFor(pk));
     }
 
     /**
@@ -57,10 +57,10 @@
      * @throws NoRowsException Primary key was not found in database.
      * @throws TooManyRowsException Primary key was not found in database.
      */
-    public static $dbObjectClassName retrieveByPK($columnFieldType pk, Connection con)
+    public $dbObjectClassName retrieveByPK($columnFieldType pk, Connection con)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
-        return ${peerClassName}.retrieveByPK(SimpleKey.keyFor(pk), con);
+        return retrieveByPK(SimpleKey.keyFor(pk), con);
     }
     
     
@@ -75,7 +75,7 @@
      * @param $columnField $columnFieldType
     #end
      */
-    public static $dbObjectClassName retrieveByPK(
+    public $dbObjectClassName retrieveByPK(
     #set ( $elementCount = 1 )
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
@@ -90,7 +90,7 @@
         $dbObjectClassName retVal = null;
         try
         {
-           db = Torque.getConnection(DATABASE_NAME);
+           db = Torque.getConnection(${peerClassName}.DATABASE_NAME);
            retVal = retrieveByPK(
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
@@ -115,7 +115,7 @@
     #end
      * @param con Connection
      */
-    public static $dbObjectClassName retrieveByPK(
+    public $dbObjectClassName retrieveByPK(
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
       #set ( $columnFieldType = $columnElement.getAttribute("fieldType") )
@@ -128,7 +128,7 @@
     #foreach ($columnElement in $primaryKeyColumnElements)
       #set ( $columnField = $columnElement.getAttribute("field") )
       #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-        criteria.add($peerColumnName, $columnField);
+        criteria.add(${peerClassName}.${peerColumnName}, $columnField);
     #end
         List<${dbObjectClassName}> v = doSelect(criteria, con);
         if (v.size() == 1)
@@ -151,15 +151,15 @@
      * @throws NoRowsException Primary key was not found in database.
      * @throws TooManyRowsException Primary key was not found in database.
      */
-    public static $dbObjectClassName retrieveByPK(ObjectKey pk)
+    public $dbObjectClassName retrieveByPK(ObjectKey pk)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
         Connection db = null;
         $dbObjectClassName retVal;
         try
         {
-            db = Torque.getConnection(DATABASE_NAME);
-            retVal = ${peerClassName}.retrieveByPK(pk, db);
+            db = Torque.getConnection(${peerClassName}.DATABASE_NAME);
+            retVal = retrieveByPK(pk, db);
         }
         finally
         {
@@ -178,11 +178,11 @@
      * @throws NoRowsException Primary key was not found in database.
      * @throws TooManyRowsException Primary key was not found in database.
      */
-    public static $dbObjectClassName retrieveByPK(ObjectKey pk, Connection con)
+    public $dbObjectClassName retrieveByPK(ObjectKey pk, Connection con)
         throws TorqueException, NoRowsException, TooManyRowsException
     {
         Criteria criteria = buildCriteria(pk);
-        List<${dbObjectClassName}> v = ${peerClassName}.doSelect(criteria, con);
+        List<${dbObjectClassName}> v = doSelect(criteria, con);
         if (v.size() == 0)
         {
             throw new NoRowsException("Failed to select a row.");

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPKs.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPKs.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPKs.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/retrieveByPKs.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/retrieveByPKs.vm Sat May 14 17:34:23 2011
@@ -36,15 +36,15 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks)
+    public List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks)
         throws TorqueException
     {
         Connection db = null;
         List<${dbObjectClassName}> retVal = null;
         try
         {
-           db = Torque.getConnection(DATABASE_NAME);
-           retVal = ${peerClassName}.retrieveByPKs(pks, db);
+           db = Torque.getConnection(${peerClassName}.DATABASE_NAME);
+           retVal = retrieveByPKs(pks, db);
         }
         finally
         {
@@ -61,7 +61,7 @@
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-    public static List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks, Connection dbcon)
+    public List<${dbObjectClassName}> retrieveByPKs(List<ObjectKey> pks, Connection dbcon)
         throws TorqueException
     {
         List<${dbObjectClassName}> objs = null;
@@ -95,7 +95,7 @@
                 criteria.or(c0);
             }
   #end
-            objs = ${peerClassName}.doSelect(criteria, dbcon);
+            objs = doSelect(criteria, dbcon);
         }
         return objs;
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/setDbName.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/setDbName.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/setDbName.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/setDbName.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/setDbName.vm Sat May 14 17:34:23 2011
@@ -29,6 +29,6 @@
         // another value so == check is okay and faster
         if (crit.getDbName() == Torque.getDefaultDB())
         {
-            crit.setDbName(DATABASE_NAME);
+            crit.setDbName(${peerClassName}.DATABASE_NAME);
         }
     }

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/peerImpl.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/peerImpl.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/peerImpl.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/peer.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/peerImpl.vm Sat May 14 17:34:23 2011
@@ -26,8 +26,8 @@
 package ${peerPackage};
 
 $torqueGen.mergepoint("classJavadoc")
-public class ${peerClassName}
-    extends ${basePeerPackage}.${basePeerClassName}
+public class ${peerImplClassName}
+    extends ${basePeerPackage}.${basePeerImplClassName}
 {
 $torqueGen.mergepoint("serialVersionUid")
 $torqueGen.mergepoint("extensions")

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/createDbObjectInstanceFromInheritance.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/createDbObjectInstanceFromInheritance.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/createDbObjectInstanceFromInheritance.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/createDbObjectInstanceFromInheritance.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/createDbObjectInstanceFromInheritance.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/createDbObjectInstanceFromInheritance.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/createDbObjectInstanceFromInheritance.vm Sat May 14 17:34:23 2011
@@ -30,6 +30,7 @@
 #set ( $inheritanceBaseColumnElement = $torqueGen.getSourceElement() )
 #set ( $tableElement = $torqueGen.getParent() )
 #set ( $tableField = $tableElement.getAttribute("field") )
+#set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
 #set ( $dbObjectClassName = $tableElement.getAttribute("dbObjectClassName") )
 #set ( $columnElement = $inheritanceBaseColumnElement.getChild("column") )
 #set ( $inheritanceElements = $columnElement.getChildren("inheritance"))
@@ -48,7 +49,7 @@
     #if ($primitive)
             $if (classKey == $inheritanceClasskeyConstant)
     #else
-            $if (${inheritanceClasskeyConstant}.equals(classKey))
+            $if (${peerClassName}.${inheritanceClasskeyConstant}.equals(classKey))
     #end
             {
                 $tableField = new ${inheritanceClassName}();

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/recordMapper.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/recordMapper.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/recordmapper/recordMapper.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/base/recordMapperBase.vm Sat May 14 17:34:23 2011
@@ -27,23 +27,60 @@
 ## The attributes of the current source element must be set
 ## as velocity variables.  
 ##
-    public static class $recordMapperClass implements RecordMapper<$dbObjectClassName>
+package ${baseRecordMapperPackage};
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.torque.TorqueException;
+import org.apache.torque.om.mapper.RecordMapper;
+
+#if (${baseRecordMapperPackage} != $dbObjectPackage)
+import ${dbObjectPackage}.${dbObjectClassName};
+#end
+#set ( $inheritanceBaseColumnElements = $torqueGen.getChildren("inheritance-column"))
+## there should at most be one inheritance-column in each table
+#foreach ($inheritanceBaseColumnElement in $inheritanceBaseColumnElements)
+  #set ( $columnElement = $inheritanceBaseColumnElement.getChild("column") )
+  #set ( $inheritanceElements = $columnElement.getChildren("inheritance"))
+  #if ($inheritanceElements.size() > 0)
+import ${peerPackage}.${peerClassName};
+    #if (${baseRecordMapperPackage} != $dbObjectPackage)
+      #foreach ($inheritanceElement in $inheritanceElements)
+        #set ( $inheritanceClassName = $inheritanceElement.getAttribute("className") )
+import ${dbObjectPackage}.${inheritanceClassName};
+      #end
+    #end
+  #end
+#end
+    
+/**
+ * Maps ResultSet rows into ${dbObjectClassName} objects.
+ *
+#if ($torqueGen.booleanOption("torque.om.addTimeStamp"))
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [${torqueGen.now()}]
+ *
+#end
+ */
+public class ${baseRecordMapperClassName} implements RecordMapper<${dbObjectClassName}>
+{
+    /**
+     * Constructs the object from the current row in the resultSet.
+     *
+     * @param resultSet the resultSet to operate on, already pointing
+     *        to the correct row. Not null.
+     * @param a possible offset in the rows to be considered
+     *        (if previous rows contain other objects).
+     *
+     * @return the mapped object, not null.
+     *
+     * @throws TorqueException when reading fields from the RecordSet fails.
+     */
+    public $dbObjectClassName processRow(ResultSet resultSet, int offset)
+            throws TorqueException
     {
-        /**
-         * Constructs the object from the current row in the resultSet.
-         *
-         * @param resultSet the resultSet to operate on, already pointing
-         *        to the correct row. Not null.
-         * @param a possible offset in the rows to be considered
-         *        (if previous rows contain other objects).
-         *
-         * @return the mapped object, not null.
-         *
-         * @throws TorqueException when reading fields from the RecordSet fails.
-         */
-        public $dbObjectClassName processRow(ResultSet resultSet, int offset)
-                throws TorqueException
-        {
 #set ( $inheritanceBaseColumnElement = $torqueGen.getChild("inheritance-column") )
 #if ($inheritanceBaseColumnElement)
 $torqueGen.mergepoint("createDbObjectInstanceFromInheritance")
@@ -54,14 +91,14 @@ $torqueGen.mergepoint("createDbObjectIns
 #foreach ($columnElement in $torqueGen.getChildren("column"))
   #set ( $setter = $columnElement.getAttribute("setter") )
   #set ( $getter = $columnElement.getAttribute("getter") )
-           $field.${setter}(
-                   ${getter}(resultSet, offset + $n));
+       $field.${setter}(
+              ${getter}(resultSet, offset + $n));
   #set ( $n = $n + 1 )
 #end
-           ${field}.setNew(false);
-           ${field}.setModified(false);
-           return $field;
-        }
+       ${field}.setNew(false);
+       ${field}.setModified(false);
+       return $field;
+    }
 
 $torqueGen.mergepoint("dbObjectFieldGetters")
-    }
+}

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/recordMapper.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/recordMapper.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/recordMapper.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/recordmapper/recordMapper.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,48 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the base peer's mapper class. 
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The attributes of the current source element must be set
+## as velocity variables.  
+##
+package ${recordMapperPackage};
+
+#if (${baseRecordMapperPackage} != $recordMapperPackage)
+import ${baseRecordMapperPackage}.${baseRecordMapperClassName};
+#end
+
+/**
+ * Maps ResultSet rows into ${dbObjectClassName} objects.
+ *
+#if ($torqueGen.booleanOption("torque.om.addTimeStamp"))
+ * The skeleton for this class was autogenerated by Torque on:
+ *
+ * [${torqueGen.now()}]
+ *
+#end
+ */
+public class ${recordMapperClassName} extends ${baseRecordMapperClassName}
+{
+}

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/OMTableTransformer.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/OMTableTransformer.properties?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/OMTableTransformer.properties (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/transformer/om/OMTableTransformer.properties Sat May 14 17:34:23 2011
@@ -19,15 +19,20 @@ ${attribute(noOverride):dbObjectClassNam
 ${attribute(noOverride):baseDbObjectClassName}=${option:torque.om.className.baseDbObjectClassNamePrefix}${attribute:javaName}${option:torque.om.className.baseDbObjectClassNameSuffix}
 ${attribute(noOverride):peerClassName}=${option:torque.om.className.peerClassNamePrefix}${attribute:javaName}${option:torque.om.className.peerClassNameSuffix}
 ${attribute(noOverride):basePeerClassName}=${option:torque.om.className.basePeerClassNamePrefix}${attribute:javaName}${option:torque.om.className.basePeerClassNameSuffix}
+${attribute(noOverride):peerImplClassName}=${option:torque.om.className.peerImplClassNamePrefix}${attribute:javaName}${option:torque.om.className.peerImplClassNameSuffix}
+${attribute(noOverride):basePeerImplClassName}=${option:torque.om.className.basePeerImplClassNamePrefix}${attribute:javaName}${option:torque.om.className.basePeerImplClassNameSuffix}
 ${attribute(noOverride):beanClassName}=${option:torque.om.className.beanClassNamePrefix}${attribute:javaName}${option:torque.om.className.beanClassNameSuffix}
 ${attribute(noOverride):baseBeanClassName}=${option:torque.om.className.baseBeanClassNamePrefix}${attribute:javaName}${option:torque.om.className.baseBeanClassNameSuffix}
 ${attribute(noOverride):mapBuilderClassName}=${option:torque.om.className.mapBuilderClassNamePrefix}${attribute:javaName}${option:torque.om.className.mapBuilderClassNameSuffix}
-${attribute(noOverride):recordMapperClass}=${option:torque.om.className.recordMapperClassNamePrefix}${attribute:javaName}${option:torque.om.className.recordMapperClassNameSuffix}
+${attribute(noOverride):recordMapperClassName}=${option:torque.om.className.recordMapperClassNamePrefix}${attribute:javaName}${option:torque.om.className.recordMapperClassNameSuffix}
+${attribute(noOverride):baseRecordMapperClassName}=${option:torque.om.className.baseRecordMapperClassNamePrefix}${attribute:javaName}${option:torque.om.className.baseRecordMapperClassNameSuffix}
 
 ${attribute(noOverride):dbObjectPackage}=${option:torque.om.package.package}${option:torque.om.package.dbObjectPackageSuffix}
 ${attribute(noOverride):baseDbObjectPackage}=${option:torque.om.package.package}${option:torque.om.package.baseDbObjectPackageSuffix}
 ${attribute(noOverride):peerPackage}=${option:torque.om.package.package}${option:torque.om.package.peerPackageSuffix}
 ${attribute(noOverride):basePeerPackage}=${option:torque.om.package.package}${option:torque.om.package.basePeerPackageSuffix}
+${attribute(noOverride):recordMapperPackage}=${option:torque.om.package.package}${option:torque.om.package.recordMapperPackageSuffix}
+${attribute(noOverride):baseRecordMapperPackage}=${option:torque.om.package.package}${option:torque.om.package.baseRecordMapperPackageSuffix}
 ${attribute(noOverride):managerPackage}=${option:torque.om.package.package}${option:torque.om.package.managerPackageSuffix}
 ${attribute(noOverride):baseManagerPackage}=${option:torque.om.package.package}${option:torque.om.package.baseManagerPackageSuffix}
 ${attribute(noOverride):beanPackage}=${option:torque.om.package.package}${option:torque.om.package.beanPackageSuffix}



---------------------------------------------------------------------
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