You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2012/08/20 05:24:19 UTC

svn commit: r1374905 [1/2] - in /db/torque/torque4/trunk: torque-runtime/src/main/java/org/apache/torque/oid/ torque-runtime/src/main/java/org/apache/torque/util/ torque-runtime/src/test/java/org/apache/torque/util/ torque-site/src/site/xdoc/ torque-te...

Author: tfischer
Date: Mon Aug 20 03:24:18 2012
New Revision: 1374905

URL: http://svn.apache.org/viewvc?rev=1374905&view=rev
Log:
Torque-220
- Removed references to BasePeer by BasePeerImpl() constructors 
- Changed BasePeerImpl getters to throw TorqueExceptions in case of non-initialisation
- updated migration guide to contain differences for doDelete with old and new criteria
- changed doSelectSingleRecord() methods to template methods
- Removed tableMap from method signatures in BasePeer and from ColumnValues instance. Use tableMap from peer instance instead.
- removed throws clause from addSelectColumns
- changed LargeSelect to use CriteriaInterface<?> again

Added:
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/executeStatement.vm
Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AutoIncrementIdGenerator.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/SequenceIdGenerator.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java
    db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm
    db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/BasePeerTest.java
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AutoIncrementIdGenerator.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AutoIncrementIdGenerator.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AutoIncrementIdGenerator.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/AutoIncrementIdGenerator.java Mon Aug 20 03:24:18 2012
@@ -31,7 +31,7 @@ import org.apache.torque.om.mapper.LongM
 import org.apache.torque.om.mapper.RecordMapper;
 import org.apache.torque.om.mapper.StringMapper;
 import org.apache.torque.sql.SqlBuilder;
-import org.apache.torque.util.BasePeer;
+import org.apache.torque.util.BasePeerImpl;
 
 /**
  * This generator works with databases that have an sql syntax that
@@ -186,7 +186,10 @@ public class AutoIncrementIdGenerator im
                 databaseName);
         String idSql = adapter.getIDMethodSQL(tableName);
 
-        List<T> result = BasePeer.doSelect(idSql, mapper, null, connection);
+        List<T> result = new BasePeerImpl<Object>().doSelect(
+                idSql,
+                mapper,
+                connection);
         return result.get(0);
     }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/SequenceIdGenerator.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/SequenceIdGenerator.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/SequenceIdGenerator.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/oid/SequenceIdGenerator.java Mon Aug 20 03:24:18 2012
@@ -31,7 +31,7 @@ import org.apache.torque.om.mapper.LongM
 import org.apache.torque.om.mapper.RecordMapper;
 import org.apache.torque.om.mapper.StringMapper;
 import org.apache.torque.sql.SqlBuilder;
-import org.apache.torque.util.BasePeer;
+import org.apache.torque.util.BasePeerImpl;
 
 /**
  * This generator works with databases that have an sql syntax for
@@ -179,7 +179,10 @@ public class SequenceIdGenerator impleme
                         databaseName);
         String idSql = adapter.getIDMethodSQL(sequenceName);
 
-        List<T> result = BasePeer.doSelect(idSql, mapper, null, connection);
+        List<T> result = new BasePeerImpl<Object>().doSelect(
+                idSql,
+                mapper,
+                connection);
         return result.get(0);
     }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeer.java Mon Aug 20 03:24:18 2012
@@ -44,9 +44,12 @@ import org.apache.torque.om.mapper.Recor
  * @author <a href="mailto:vido@ldh.org">Augustin Vidovic</a>
  * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
  * @version $Id$
+ *
+ * @deprecated This class is not used any more as base class for the generated
+ *             Peer classes and will be removed in a future version of Torque.
  */
-public abstract class BasePeer
-        implements Serializable
+@Deprecated
+public abstract class BasePeer implements Serializable
 {
     /**
      * Serial Version
@@ -248,96 +251,6 @@ public abstract class BasePeer
     }
 
     /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to use.
-     * @param tableMap the table to delete records from.
-     *         If set to null, the name of the table(s) can be extracted from
-     *         the criteria, but this can cause unexpected results.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, String).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    public static int doDelete(Criteria criteria, TableMap tableMap)
-            throws TorqueException
-    {
-        return getBasePeerImpl().doDelete(criteria, tableMap);
-    }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to use.
-     * @param tableName the table to delete records from.
-     *         If set to null, the name of the table(s) can be extracted from
-     *         the criteria, but this can cause unexpected results.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     */
-    public static int doDelete(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap tableMap)
-            throws TorqueException
-    {
-        return getBasePeerImpl().doDelete(criteria, tableMap);
-    }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to select the records to be deleted,
-     *        not null.
-     * @param tableName the name of the table to delete records from, not null.
-     * @param con The database connection for deletion, not null.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, String, Connection).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    public static int doDelete(
-                Criteria criteria,
-                TableMap tableMap,
-                Connection connection)
-            throws TorqueException
-    {
-        return getBasePeerImpl().doDelete(criteria, tableMap, connection);
-    }
-
-    /**
-     * Method to perform deletes based on values and keys in a Criteria.
-     *
-     * @param criteria The criteria to select the records to be deleted,
-     *        not null.
-     * @param tableMap the table to delete records from, not null.
-     * @param con The database connection for deletion, not null.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     */
-    public static int doDelete(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap tableMap,
-                Connection connection)
-            throws TorqueException
-    {
-        return getBasePeerImpl().doDelete(criteria, tableMap, connection);
-    }
-
-    /**
      * Inserts a record into a database table.
      * <p>
      * If the primary key is included in Criteria, then that value will
@@ -400,8 +313,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The results of the query, not null.
      *
@@ -414,12 +325,11 @@ public abstract class BasePeer
     @Deprecated
     public static <T> List<T> doSelect(
                 Criteria criteria,
-                RecordMapper<T> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<T> mapper)
             throws TorqueException
     {
         BasePeerImpl<T> bpi = getBasePeerImpl();
-        return bpi.doSelect(criteria, mapper, defaultTableMap);
+        return bpi.doSelect(criteria, mapper);
     }
 
     /**
@@ -428,8 +338,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The results of the query, not null.
      *
@@ -437,12 +345,11 @@ public abstract class BasePeer
      */
     public static <T> List<T> doSelect(
                 org.apache.torque.criteria.Criteria criteria,
-                RecordMapper<T> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<T> mapper)
             throws TorqueException
     {
         BasePeerImpl<T> bpi = getBasePeerImpl();
-        return bpi.doSelect(criteria, mapper, defaultTableMap);
+        return bpi.doSelect(criteria, mapper);
     }
 
     /**
@@ -451,8 +358,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, TODO or null ???.
      * @param connection the database connection for selecting records,
      *        not null.
      *
@@ -467,7 +372,6 @@ public abstract class BasePeer
     public static <T> List<T> doSelect(
             Criteria criteria,
             RecordMapper<T> mapper,
-            TableMap defaultTableMap,
             Connection connection)
         throws TorqueException
     {
@@ -475,7 +379,6 @@ public abstract class BasePeer
         return bpi.doSelect(
                 criteria,
                 mapper,
-                defaultTableMap,
                 connection);
     }
 
@@ -485,8 +388,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, TODO or null ???.
      * @param connection the database connection for selecting records,
      *        not null.
      *
@@ -496,7 +397,6 @@ public abstract class BasePeer
     public static <T> List<T> doSelect(
             org.apache.torque.criteria.Criteria criteria,
             RecordMapper<T> mapper,
-            TableMap defaultTableMap,
             Connection connection)
         throws TorqueException
     {
@@ -504,7 +404,6 @@ public abstract class BasePeer
         return bpi.doSelect(
                 criteria,
                 mapper,
-                defaultTableMap,
                 connection);
     }
 
@@ -514,8 +413,6 @@ public abstract class BasePeer
      * @param query the sql query to execute, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param dbName The name of the database to create the connection for,
      *        or null for the default SDB.
      *
@@ -526,7 +423,6 @@ public abstract class BasePeer
     public static <T> List<T> doSelect(
                 String query,
                 RecordMapper<T> mapper,
-                TableMap defaultTableMap,
                 String dbName)
             throws TorqueException
     {
@@ -534,7 +430,6 @@ public abstract class BasePeer
         return bpi.doSelect(
                 query,
                 mapper,
-                defaultTableMap,
                 dbName);
     }
 
@@ -544,8 +439,6 @@ public abstract class BasePeer
      * @param query the SQL Query to execute, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param connection the database connection, not null.
      *
      * @return The results of the query, not null.
@@ -555,7 +448,6 @@ public abstract class BasePeer
     public static <T> List<T> doSelect(
                 String query,
                 RecordMapper<T> mapper,
-                TableMap defaultTableMap,
                 Connection connection)
             throws TorqueException
     {
@@ -563,7 +455,6 @@ public abstract class BasePeer
         return bpi.doSelect(
                 query,
                 mapper,
-                defaultTableMap,
                 connection);
     }
 
@@ -573,8 +464,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The selected row, or null if no records was selected.
      *
@@ -582,15 +471,13 @@ public abstract class BasePeer
      */
     public static <T> T doSelectSingleRecord(
                 org.apache.torque.criteria.Criteria criteria,
-                RecordMapper<T> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<T> mapper)
             throws TorqueException
     {
         BasePeerImpl<T> bpi = getBasePeerImpl();
         return bpi.doSelectSingleRecord(
                 criteria,
-                mapper,
-                defaultTableMap);
+                mapper);
     }
 
     /**
@@ -599,8 +486,6 @@ public abstract class BasePeer
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param connection the database connection, not null.
      *
      * @return The selected row, or null if no records was selected.
@@ -610,7 +495,6 @@ public abstract class BasePeer
     public static <T> T doSelectSingleRecord(
                 org.apache.torque.criteria.Criteria criteria,
                 RecordMapper<T> mapper,
-                TableMap defaultTableMap,
                 Connection connection)
             throws TorqueException
     {
@@ -618,7 +502,6 @@ public abstract class BasePeer
         return bpi.doSelectSingleRecord(
                 criteria,
                 mapper,
-                defaultTableMap,
                 connection);
     }
 
@@ -838,8 +721,6 @@ public abstract class BasePeer
      *
      * @param criteria The criteria to be checked for booleanint and booleanchar
      *        columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      *
@@ -849,11 +730,10 @@ public abstract class BasePeer
      */
     @Deprecated
     public static void correctBooleans(
-                Criteria criteria,
-                TableMap defaultTableMap)
+                Criteria criteria)
             throws TorqueException
     {
-        getBasePeerImpl().correctBooleans(criteria, defaultTableMap);
+        getBasePeerImpl().correctBooleans(criteria);
     }
 
     /**
@@ -865,17 +745,14 @@ public abstract class BasePeer
      *
      * @param criteria The criteria to be checked for booleanint and booleanchar
      *        columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      */
     public static void correctBooleans(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap defaultTableMap)
+                org.apache.torque.criteria.Criteria criteria)
             throws TorqueException
     {
-        getBasePeerImpl().correctBooleans(criteria, defaultTableMap);
+        getBasePeerImpl().correctBooleans(criteria);
     }
 
     /**
@@ -887,8 +764,6 @@ public abstract class BasePeer
      *
      * @param columnValues The value to be checked for booleanint
      *        and booleanchar columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      */

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java Mon Aug 20 03:24:18 2012
@@ -43,7 +43,6 @@ import org.apache.torque.adapter.Adapter
 import org.apache.torque.adapter.IDMethod;
 import org.apache.torque.criteria.FromElement;
 import org.apache.torque.map.ColumnMap;
-import org.apache.torque.map.DatabaseMap;
 import org.apache.torque.map.MapHelper;
 import org.apache.torque.map.TableMap;
 import org.apache.torque.oid.IdGenerator;
@@ -63,6 +62,8 @@ import org.apache.torque.sql.SqlBuilder;
  * utility methods which ease execution of cross-database queries and
  * the implementation of concrete Peers.
  *
+ * @param <T> The data object class for this Peer.
+ *
  * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
  * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
@@ -80,7 +81,7 @@ public class BasePeerImpl<T> implements 
     private static final long serialVersionUID = -7702123730779032381L;
 
     /** the log */
-    private static final Log log = LogFactory.getLog(BasePeer.class);
+    private static final Log log = LogFactory.getLog(BasePeerImpl.class);
 
     /** An injected instance of a record mapper to map JDBC result sets to objects */
     private RecordMapper<T> recordMapper = null;
@@ -100,7 +101,7 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * Constructor providing the objects to be injected as parameters
+     * Constructor providing the objects to be injected as parameters.
      *
      * @param recordMapper a record mapper to map JDBC result sets to objects
      * @param tableMap the default table map
@@ -115,7 +116,7 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * Set the record mapper for this instance
+     * Set the record mapper for this instance.
      *
      * @param recordMapper the recordMapper to set
      */
@@ -129,18 +130,18 @@ public class BasePeerImpl<T> implements 
      *
      * @return the recordMapper
      */
-    public RecordMapper<T> getRecordMapper()
+    public RecordMapper<T> getRecordMapper() throws TorqueException
     {
         if (recordMapper == null)
         {
-            throw new RuntimeException("No record mapper injected");
+            throw new TorqueException("No record mapper injected");
         }
 
         return recordMapper;
     }
 
     /**
-     * Set the default table map for this instance
+     * Set the default table map for this instance.
      *
      * @param tableMap the tableMap to set
      */
@@ -150,22 +151,22 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * Get the default table map for this instance
+     * Get the default table map for this instance.
      *
      * @return the tableMap
      */
-    public TableMap getTableMap()
+    public TableMap getTableMap() throws TorqueException
     {
         if (tableMap == null)
         {
-            throw new RuntimeException("No table map injected");
+            throw new TorqueException("No table map injected");
         }
 
         return tableMap;
     }
 
     /**
-     * Set the database name for this instance
+     * Set the database name for this instance.
      *
      * @param databaseName the databaseName to set
      */
@@ -175,15 +176,15 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * Get the database name for this instance
+     * Get the database name for this instance.
      *
      * @return the databaseName
      */
-    public String getDatabaseName()
+    public String getDatabaseName() throws TorqueException
     {
         if (databaseName == null)
         {
-            throw new RuntimeException("No database name injected");
+            throw new TorqueException("No database name injected");
         }
 
         return databaseName;
@@ -380,201 +381,35 @@ public class BasePeerImpl<T> implements 
      * during a transaction, otherwise use the doDelete(Criteria) method.
       *
      * @param criteria defines the rows to be deleted, not null.
-     * @param con the connection to use, not null.
+     * @param connection the connection to use, not null.
      *
      * @return the number of deleted rows.
      *
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
-     public int doDelete(org.apache.torque.criteria.Criteria criteria, Connection con)
+     public int doDelete(
+             org.apache.torque.criteria.Criteria criteria,
+             Connection connection)
         throws TorqueException
      {
         correctBooleans(criteria);
         setDbName(criteria);
 
-        return doDelete(criteria, getTableMap(), con);
-     }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to use.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated This method causes unexpected results when joins are used.
-     *             Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, TableMap).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    protected int doDelete(Criteria criteria) throws TorqueException
-    {
-        return doDelete(criteria, (TableMap) null);
-    }
-
-    /**
-     * Method to perform deletes based on conditions a Criteria.
-     *
-     * @param criteria The criteria to use.
-     * @param con the Connection to be used for deleting.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated This method causes unexpected results when joins are used.
-     *             Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, TableMap, Connection).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    protected int doDelete(Criteria criteria, Connection con)
-        throws TorqueException
-    {
-        if (criteria.values().isEmpty())
-        {
-            throw new TorqueException("No conditions found in Criteria");
-        }
-        Criteria.Criterion criterion
-                = criteria.values().iterator().next();
-        TableMap tableMap = MapHelper.getTableMap(
-                criterion.getColumn(), criteria, null);
-        if (tableMap == null)
-        {
-            throw new TorqueException("Unqualified column name in criteria"
-                    + " or table name not found in database map");
-        }
-        return doDelete(criteria, tableMap, con);
-    }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to use.
-     * @param tableMap the table to delete records from.
-     *        If set to null, the name of the table(s) can be extracted from
-     *        the criteria, but this can cause unexpected results
-     *        when joins are used.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, String).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    public int doDelete(Criteria criteria, TableMap tableMap)
-            throws TorqueException
-    {
-        Connection con = null;
-        try
-        {
-            con = Transaction.begin(criteria.getDbName());
-            int result = doDelete(criteria, tableMap, con);
-            Transaction.commit(con);
-            con = null;
-            return result;
-        }
-        finally
-        {
-            if (con != null)
-            {
-                Transaction.safeRollback(con);
-            }
-        }
-    }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to use.
-     * @param tableMap the table to delete records from.
-     *        If set to null, the name of the table(s) can be extracted from
-     *        the criteria, but this can cause unexpected results
-     *        when joins are used.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     */
-    public int doDelete(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap tableMap)
-            throws TorqueException
-    {
-        Connection con = null;
-        try
-        {
-            con = Transaction.begin(criteria.getDbName());
-            int result = doDelete(criteria, tableMap, con);
-            Transaction.commit(con);
-            con = null;
-            return result;
-        }
-        finally
-        {
-            if (con != null)
-            {
-                Transaction.safeRollback(con);
-            }
-        }
-    }
-
-    /**
-     * Method to perform deletes based on conditions in a Criteria.
-     *
-     * @param criteria The criteria to select the records to be deleted,
-     *        not null.
-     * @param tableMap the table to delete records from.
-     *        If set to null, the name of the table(s) can be extracted from
-     *        the criteria, but this can cause unexpected results
-     *        when joins are used.
-     * @param con The database connection for deletion, not null.
-     *
-     * @return the number of deleted rows.
-     *
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
-     *
-     * @deprecated Please use doDelete(
-     *                 org.apache.torque.criteria.Criteria, String, Connection).
-     *             This method will be removed in a future version of Torque.
-     */
-    @Deprecated
-    public int doDelete(
-                Criteria criteria,
-                TableMap tableMap,
-                Connection connection)
-            throws TorqueException
-    {
         Query query = SqlBuilder.buildQuery(criteria);
         query.setType(Query.Type.DELETE);
 
-        String fullTableName = null;
-        if (tableMap != null)
+        String fullTableName;
+        if (tableMap == null)
         {
-            fullTableName = SqlBuilder.getFullTableName(
-                    tableMap.getName(),
-                    criteria.getDbName());
+            fullTableName = SqlBuilder.guessFullTableFromCriteria(criteria);
         }
         else
         {
-            Column column = criteria.values().iterator().next().getColumn();
             fullTableName = SqlBuilder.getFullTableName(
-                    column.getFullTableName(),
+                    tableMap.getName(),
                     criteria.getDbName());
         }
-
         boolean ownTableAdded = false;
         for (FromElement fromElement : query.getFromClause())
         {
@@ -632,44 +467,97 @@ public class BasePeerImpl<T> implements 
                 }
             }
         }
-    }
+     }
 
     /**
      * Method to perform deletes based on conditions in a Criteria.
      *
-     * @param criteria The criteria to select the records to be deleted,
-     *        not null.
-     * @param tableMap the table to delete records from.
-     *        If set to null, the name of the table(s) can be extracted from
-     *        the criteria, but this can cause unexpected results
-     *        when joins are used.
-     * @param con The database connection for deletion, not null.
+     * @param criteria The criteria to use.
      *
      * @return the number of deleted rows.
      *
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
+     *
+     * @deprecated This method causes unexpected results when joins are used.
+     *             Please use doDelete(
+     *                 org.apache.torque.criteria.Criteria, TableMap).
+     *             This method will be removed in a future version of Torque.
      */
-    public int doDelete(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap tableMap,
-                Connection connection)
-            throws TorqueException
+    @Deprecated
+    protected int doDelete(Criteria criteria) throws TorqueException
+    {
+        Connection con = null;
+        try
+        {
+            con = Transaction.begin(criteria.getDbName());
+            int result = doDelete(criteria, con);
+            Transaction.commit(con);
+            con = null;
+            return result;
+        }
+        finally
+        {
+            if (con != null)
+            {
+                Transaction.safeRollback(con);
+            }
+        }
+    }
+
+    /**
+     * Method to perform deletes based on conditions a Criteria.
+     *
+     * @param criteria The criteria to use.
+     * @param con the Connection to be used for deleting.
+     *
+     * @return the number of deleted rows.
+     *
+     * @throws TorqueException Any exceptions caught during processing will be
+     *         rethrown wrapped into a TorqueException.
+     *
+     * @deprecated This method causes unexpected results when joins are used.
+     *             Please use doDelete(
+     *                 org.apache.torque.criteria.Criteria, TableMap, Connection).
+     *             This method will be removed in a future version of Torque.
+     */
+    @Deprecated
+    protected int doDelete(Criteria criteria, Connection con)
+        throws TorqueException
     {
+        if (criteria.values().isEmpty())
+        {
+            throw new TorqueException("No conditions found in Criteria");
+        }
+        Criteria.Criterion criterion
+                = criteria.values().iterator().next();
+
+        TableMap tableMapFromCriteria = MapHelper.getTableMap(
+                criterion.getColumn(), criteria, null);
+        if (tableMapFromCriteria == null)
+        {
+            throw new TorqueException("Unqualified column name in criteria"
+                    + " or table name not found in database map");
+        }
+
         Query query = SqlBuilder.buildQuery(criteria);
         query.setType(Query.Type.DELETE);
 
-        String fullTableName;
-        if (tableMap == null)
+        String fullTableName = null;
+        if (tableMap != null)
         {
-            fullTableName = SqlBuilder.guessFullTableFromCriteria(criteria);
+            fullTableName = SqlBuilder.getFullTableName(
+                    tableMap.getName(),
+                    criteria.getDbName());
         }
         else
         {
+            Column column = criteria.values().iterator().next().getColumn();
             fullTableName = SqlBuilder.getFullTableName(
-                    tableMap.getName(),
+                    column.getFullTableName(),
                     criteria.getDbName());
         }
+
         boolean ownTableAdded = false;
         for (FromElement fromElement : query.getFromClause())
         {
@@ -690,7 +578,7 @@ public class BasePeerImpl<T> implements 
         PreparedStatement preparedStatement = null;
         try
         {
-            preparedStatement = connection.prepareStatement(sql);
+            preparedStatement = con.prepareStatement(sql);
             List<Object> replacements = setPreparedStatementReplacements(
                     preparedStatement,
                     query.getPreparedStatementReplacements(),
@@ -753,16 +641,15 @@ public class BasePeerImpl<T> implements 
     public ObjectKey doInsert(ColumnValues insertValues)
           throws TorqueException
     {
-        String databaseName = insertValues.getDbName();
-        if (databaseName == null)
+        String databaseNameFromInsertValues = insertValues.getDbName();
+        if (databaseNameFromInsertValues == null)
         {
-            TableMap table = insertValues.getTable();
-            databaseName = table.getDatabaseMap().getDatabase().getName();
+            databaseNameFromInsertValues = getDatabaseName();
         }
         Connection connection = null;
         try
         {
-            connection = Transaction.begin(databaseName);
+            connection = Transaction.begin(databaseNameFromInsertValues);
             ObjectKey id = doInsert(insertValues, connection);
             Transaction.commit(connection);
             connection = null;
@@ -812,12 +699,15 @@ public class BasePeerImpl<T> implements 
         {
             throw new TorqueException("connection is null");
         }
-        TableMap tableMap = insertValues.getTable();
-        DatabaseMap dbMap = tableMap.getDatabaseMap();
-        Database database = Torque.getDatabase(dbMap.getDatabase().getName());
-        Object keyInfo = getIdMethodInfo(tableMap);
-        IdGenerator keyGen
-                = database.getIdGenerator(tableMap.getPrimaryKeyMethod());
+        String databaseNameFromInsertValues = insertValues.getDbName();
+        if (databaseNameFromInsertValues == null)
+        {
+            databaseNameFromInsertValues = getDatabaseName();
+        }
+        Database database = Torque.getDatabase(databaseNameFromInsertValues);
+        Object keyInfo = getIdMethodInfo();
+        IdGenerator keyGen = database.getIdGenerator(
+                getTableMap().getPrimaryKeyMethod());
 
         SimpleKey id = null;
         // can currently generate only single column pks, therefore a single
@@ -826,7 +716,7 @@ public class BasePeerImpl<T> implements 
         if (keyGen != null)
         {
             // fail on multiple pks
-            primaryKey = tableMap.getPrimaryKey();
+            primaryKey = getTableMap().getPrimaryKey();
 
             // primaryKey will be null if there is no primary key
             // defined for the table we're inserting into.
@@ -854,8 +744,8 @@ public class BasePeerImpl<T> implements 
         }
 
         String fullTableName = SqlBuilder.getFullTableName(
-                tableMap.getName(),
-                dbMap.getDatabase().getName());
+                getTableMap().getName(),
+                getTableMap().getDatabaseMap().getDatabase().getName());
         StringBuilder query = new StringBuilder("INSERT INTO ")
             .append(fullTableName)
             .append("(")
@@ -949,29 +839,25 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * Returns the idMethodInfo for a given table.
-     *
-     * @param tableMap the table map of the table, not null.
+     * Returns the idMethodInfo for the table for this Peer class.
      *
      * @return the idMethodInfo, not null.
      *
      * @throws TorqueException if the database adapter for the table's database
      *         needs to be accessed but is not configured.
      */
-    private Object getIdMethodInfo(TableMap tableMap)
+    private Object getIdMethodInfo()
             throws TorqueException
     {
         IDMethod idMethod = tableMap.getPrimaryKeyMethod();
         if (IDMethod.NATIVE == idMethod)
         {
-            String databaseName
-                    = tableMap.getDatabaseMap().getDatabase().getName();
-            Adapter adapter = Torque.getAdapter(databaseName);
+            Adapter adapter = Torque.getAdapter(getDatabaseName());
             if (adapter == null)
             {
                throw new TorqueException(
                    "missing adapter configuration for database "
-                       + databaseName
+                       + getDatabaseName()
                        + "check the Torque configuration");
             }
             idMethod = adapter.getIDMethodType();
@@ -1033,12 +919,10 @@ public class BasePeerImpl<T> implements 
     /**
      * Add all the columns needed to create a new object.
      *
-     * @param criteria object containing the columns to add.
-     * @throws TorqueException Any exceptions caught during processing will be
-     *         rethrown wrapped into a TorqueException.
+     * @param criteria the Criteria to which the select columns should
+     *        be added.
      */
     public void addSelectColumns(org.apache.torque.criteria.Criteria criteria)
-            throws TorqueException
     {
         ColumnMap[] columns = this.tableMap.getColumns();
 
@@ -1049,6 +933,55 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
+     * Add all the columns needed to create a new object.
+     *
+     * @param criteria the Criteria to which the select columns should
+     *        be added.
+     *
+     * @deprecated Please use addSelectColumns(
+     *                 org.apache.torque.criteria.Criteria).
+     *             This method will be removed in a future version of Torque.
+     */
+    @Deprecated
+    public void addSelectColumns(Criteria criteria)
+    {
+        ColumnMap[] columns = this.tableMap.getColumns();
+
+        for (ColumnMap c : columns)
+        {
+            criteria.addSelectColumn(c);
+        }
+    }
+
+    /**
+     * Selects objects from a database.
+     *
+     * @param criteria object used to create the SELECT statement.
+     *
+     * @return the list of selected objects, not null.
+     *
+     * @throws TorqueException Any exceptions caught during processing will be
+     *         rethrown wrapped into a TorqueException.
+     *
+     * @deprecated Please use doSelect(org.apache.torque.criteria.Criteria).
+     *             This method will be removed in a future version of Torque.
+     */
+    @Deprecated
+    public List<T> doSelect(Criteria criteria)
+            throws TorqueException
+    {
+        if (criteria.getSelectColumns().size() == 0)
+        {
+            addSelectColumns(criteria);
+        }
+        setDbName(criteria);
+
+        return doSelect(
+            criteria,
+            getRecordMapper());
+    }
+
+    /**
      * Selects objects from a database.
      *
      * @param criteria object used to create the SELECT statement.
@@ -1069,8 +1002,41 @@ public class BasePeerImpl<T> implements 
 
         return doSelect(
             criteria,
-            getRecordMapper(),
-            getTableMap());
+            getRecordMapper());
+    }
+
+    /**
+     * Selects objects from a database
+     * within a transaction.
+     *
+     * @param criteria object used to create the SELECT statement.
+     * @param connection the connection to use, not null.
+     *
+     * @return the list of selected objects, not null.
+     *
+     * @throws TorqueException Any exceptions caught during processing will be
+     *         rethrown wrapped into a TorqueException.
+     *
+     * @deprecated Please use doSelect(org.apache.torque.criteria.Criteria,
+     *                 Connection).
+     *             This method will be removed in a future version of Torque.
+     */
+    @Deprecated
+    public List<T> doSelect(
+                Criteria criteria,
+                Connection connection)
+            throws TorqueException
+    {
+        if (criteria.getSelectColumns().size() == 0)
+        {
+            addSelectColumns(criteria);
+        }
+        setDbName(criteria);
+
+        return doSelect(
+                criteria,
+                getRecordMapper(),
+                connection);
     }
 
     /**
@@ -1099,7 +1065,6 @@ public class BasePeerImpl<T> implements 
         return doSelect(
                 criteria,
                 getRecordMapper(),
-                getTableMap(),
                 connection);
     }
 
@@ -1167,22 +1132,19 @@ public class BasePeerImpl<T> implements 
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The results of the query, not null.
      *
      * @throws TorqueException if querying the database fails.
      *
      * @deprecated Please use doSelect(org.apache.torque.criteria.Criteria,
-     *                 RecordMapper, TableMap).
+     *                 RecordMapper).
      *             This method will be removed in a future version of Torque.
      */
     @Deprecated
     public <TT> List<TT> doSelect(
                 Criteria criteria,
-                RecordMapper<TT> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<TT> mapper)
             throws TorqueException
     {
         Connection connection = null;
@@ -1193,7 +1155,6 @@ public class BasePeerImpl<T> implements 
             List<TT> result = doSelect(
                     criteria,
                     mapper,
-                    defaultTableMap,
                     connection);
 
             Transaction.commit(connection);
@@ -1215,8 +1176,6 @@ public class BasePeerImpl<T> implements 
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The results of the query, not null.
      *
@@ -1224,8 +1183,7 @@ public class BasePeerImpl<T> implements 
      */
     public <TT> List<TT> doSelect(
                 org.apache.torque.criteria.Criteria criteria,
-                RecordMapper<TT> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<TT> mapper)
             throws TorqueException
     {
         Connection connection = null;
@@ -1236,7 +1194,6 @@ public class BasePeerImpl<T> implements 
             List<TT> result = doSelect(
                     criteria,
                     mapper,
-                    defaultTableMap,
                     connection);
 
             Transaction.commit(connection);
@@ -1258,8 +1215,6 @@ public class BasePeerImpl<T> implements 
      * @param query the sql query to execute, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param dbName The name of the database to create the connection for,
      *        or null for the default SDB.
      *
@@ -1270,7 +1225,6 @@ public class BasePeerImpl<T> implements 
     public <TT> List<TT> doSelect(
                 String query,
                 RecordMapper<TT> mapper,
-                TableMap defaultTableMap,
                 String dbName)
             throws TorqueException
     {
@@ -1286,7 +1240,6 @@ public class BasePeerImpl<T> implements 
             List<TT> result = doSelect(
                     query,
                     mapper,
-                    defaultTableMap,
                     connection);
 
             Transaction.commit(connection);
@@ -1308,8 +1261,6 @@ public class BasePeerImpl<T> implements 
      * @param query the SQL Query to execute, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param connection the database connection, not null.
      *
      * @return The results of the query, not null.
@@ -1319,7 +1270,6 @@ public class BasePeerImpl<T> implements 
     public <TT> List<TT> doSelect(
                 String query,
                 RecordMapper<TT> mapper,
-                TableMap defaultTableMap,
                 Connection connection)
             throws TorqueException
     {
@@ -1390,7 +1340,8 @@ public class BasePeerImpl<T> implements 
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
      * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, TODO or null ???.
+     *        unqualified columns in the query, or null in the case that
+     *        the table to select from need not be added to the query.
      * @param connection the database connection for selecting records,
      *        not null.
      *
@@ -1399,24 +1350,23 @@ public class BasePeerImpl<T> implements 
      * @throws TorqueException Error performing database query.
      *
      * @deprecated Please use doSelect(org.apache.torque.criteria.Criteria,
-     *                 RecordMapper, TableMap).
+     *                 RecordMapper, Connection).
      *             This method will be removed in a future version of Torque.
      */
     @Deprecated
     public <TT> List<TT> doSelect(
             Criteria criteria,
             RecordMapper<TT> mapper,
-            TableMap defaultTableMap,
             Connection connection)
         throws TorqueException
     {
-        correctBooleans(criteria, defaultTableMap);
+        correctBooleans(criteria);
 
         Query query = SqlBuilder.buildQuery(criteria);
-        if (query.getFromClause().isEmpty() && defaultTableMap != null)
+        if (query.getFromClause().isEmpty())
         {
             String tableName = SqlBuilder.getFullTableName(
-                    defaultTableMap.getName(),
+                    getTableMap().getName(),
                     criteria.getDbName());
             query.getFromClause().add(new FromElement(tableName));
         }
@@ -1545,8 +1495,6 @@ public class BasePeerImpl<T> implements 
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, TODO or null ???.
      * @param connection the database connection for selecting records,
      *        not null.
      *
@@ -1557,17 +1505,16 @@ public class BasePeerImpl<T> implements 
     public <TT> List<TT> doSelect(
                 org.apache.torque.criteria.Criteria criteria,
                 RecordMapper<TT> mapper,
-                TableMap defaultTableMap,
                 Connection connection)
             throws TorqueException
     {
-        correctBooleans(criteria, defaultTableMap);
+        correctBooleans(criteria);
 
         Query query = SqlBuilder.buildQuery(criteria);
-        if (query.getFromClause().isEmpty() && defaultTableMap != null)
+        if (query.getFromClause().isEmpty())
         {
             String tableName = SqlBuilder.getFullTableName(
-                    defaultTableMap.getName(),
+                    getTableMap().getName(),
                     criteria.getDbName());
             query.getFromClause().add(new FromElement(tableName));
         }
@@ -1700,21 +1647,18 @@ public class BasePeerImpl<T> implements 
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      *
      * @return The selected row, or null if no records was selected.
      *
      * @throws TorqueException if querying the database fails.
      */
-    public T doSelectSingleRecord(
+    public <TT> TT doSelectSingleRecord(
                 org.apache.torque.criteria.Criteria criteria,
-                RecordMapper<T> mapper,
-                TableMap defaultTableMap)
+                RecordMapper<TT> mapper)
             throws TorqueException
     {
-        List<T> resultList = doSelect(criteria, mapper, defaultTableMap);
-        T result = null;
+        List<TT> resultList = doSelect(criteria, mapper);
+        TT result = null;
         if (resultList.size() > 1)
         {
             throw new TooManyRowsException("Criteria " + criteria
@@ -1733,27 +1677,23 @@ public class BasePeerImpl<T> implements 
      * @param criteria A Criteria specifying the records to select, not null.
      * @param mapper The mapper creating the objects from the resultSet,
      *        not null.
-     * @param defaultTableMap The table map used for the
-     *        unqualified columns in the query, not null.
      * @param connection the database connection, not null.
      *
      * @return The selected row, or null if no records was selected.
      *
      * @throws TorqueException if querying the database fails.
      */
-    public T doSelectSingleRecord(
+    public <TT> TT doSelectSingleRecord(
                 org.apache.torque.criteria.Criteria criteria,
-                RecordMapper<T> mapper,
-                TableMap defaultTableMap,
+                RecordMapper<TT> mapper,
                 Connection connection)
             throws TorqueException
     {
-        List<T> resultList = doSelect(
+        List<TT> resultList = doSelect(
                 criteria,
                 mapper,
-                defaultTableMap,
                 connection);
-        T result = null;
+        TT result = null;
         if (resultList.size() > 1)
         {
             throw new TooManyRowsException("Criteria " + criteria
@@ -1792,16 +1732,15 @@ public class BasePeerImpl<T> implements 
     public int doUpdate(ColumnValues updateValues)
             throws TorqueException
     {
-        String databaseName = updateValues.getDbName();
-        if (databaseName == null)
+        String databaseNameFromUpdateValues = updateValues.getDbName();
+        if (databaseNameFromUpdateValues == null)
         {
-            TableMap table = updateValues.getTable();
-            databaseName = table.getDatabaseMap().getDatabase().getName();
+            databaseNameFromUpdateValues = getDatabaseName();
         }
         Connection connection = null;
         try
         {
-            connection = Transaction.begin(databaseName);
+            connection = Transaction.begin(databaseNameFromUpdateValues);
             int result = doUpdate(updateValues, connection);
             Transaction.commit(connection);
             connection = null;
@@ -1849,8 +1788,7 @@ public class BasePeerImpl<T> implements 
                 Connection connection)
             throws TorqueException
     {
-        TableMap table = updateValues.getTable();
-        ColumnMap pk = table.getPrimaryKey();
+        ColumnMap pk = getTableMap().getPrimaryKey();
         org.apache.torque.criteria.Criteria selectCriteria = null;
 
         if (pk != null && updateValues.containsKey(pk.getSqlExpression()))
@@ -1889,16 +1827,15 @@ public class BasePeerImpl<T> implements 
                 ColumnValues updateValues)
             throws TorqueException
     {
-        String databaseName = updateValues.getDbName();
-        if (databaseName == null)
+        String databaseNameFromUpdateValues = updateValues.getDbName();
+        if (databaseNameFromUpdateValues == null)
         {
-            TableMap table = updateValues.getTable();
-            databaseName = table.getDatabaseMap().getDatabase().getName();
+            databaseNameFromUpdateValues = getDatabaseName();
         }
         Connection connection = null;
         try
         {
-            connection = Transaction.begin(databaseName);
+            connection = Transaction.begin(databaseNameFromUpdateValues);
             int result = doUpdate(selectCriteria, updateValues, connection);
             Transaction.commit(connection);
             connection = null;
@@ -1930,16 +1867,15 @@ public class BasePeerImpl<T> implements 
                 ColumnValues updateValues)
             throws TorqueException
     {
-        String databaseName = updateValues.getDbName();
-        if (databaseName == null)
+        String databaseNameFromUpdateValues = updateValues.getDbName();
+        if (databaseNameFromUpdateValues == null)
         {
-            TableMap table = updateValues.getTable();
-            databaseName = table.getDatabaseMap().getDatabase().getName();
+            databaseNameFromUpdateValues = getDatabaseName();
         }
         Connection connection = null;
         try
         {
-            connection = Transaction.begin(databaseName);
+            connection = Transaction.begin(databaseNameFromUpdateValues);
             int result = doUpdate(selectCriteria, updateValues, connection);
             Transaction.commit(connection);
             connection = null;
@@ -1983,7 +1919,7 @@ public class BasePeerImpl<T> implements 
 
         query.getFromClause().clear();
         String fullTableName = SqlBuilder.getFullTableName(
-                updateValues.getTable().getName(),
+                getTableMap().getName(),
                 criteria.getDbName());
         query.getFromClause().add(new FromElement(fullTableName));
 
@@ -2080,7 +2016,7 @@ public class BasePeerImpl<T> implements 
 
         query.getFromClause().clear();
         String fullTableName = SqlBuilder.getFullTableName(
-                updateValues.getTable().getName(),
+                getTableMap().getName(),
                 criteria.getDbName());
         query.getFromClause().add(new FromElement(fullTableName));
 
@@ -2318,47 +2254,28 @@ public class BasePeerImpl<T> implements 
     }
 
     /**
-     * changes the boolean values in the criteria to the appropriate type,
+     * Changes the boolean values in the criteria to the appropriate type,
      * whenever a booleanchar or booleanint column is involved.
      * This enables the user to create criteria using Boolean values
-     * for booleanchar or booleanint columns
-     * @param criteria the criteria in which the boolean values should be corrected
-     * @throws TorqueException if the database map for the criteria cannot be
-               obtained.
-     */
-    public void correctBooleans(org.apache.torque.criteria.Criteria criteria) throws TorqueException
-    {
-        correctBooleans(criteria, getTableMap());
-    }
-
-    /**
-     * Checks all columns in the criteria to see whether
-     * booleanchar and booleanint columns are queried with a boolean.
-     * If yes, the query values are mapped onto values the database
-     * does understand, i.e. 0 and 1 for booleanints and N and Y for
-     * booleanchar columns.
+     * for booleanchar or booleanint columns.
      *
-     * @param criteria The criteria to be checked for booleanint and booleanchar
-     *        columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
+     * @param criteria the criteria in which the boolean values should be
+     *        corrected.
      * @throws TorqueException if the database map for the criteria cannot be
-     *         retrieved.
+     *         obtained.
      *
      * @deprecated Please use correctBooleans(
-     *                 org.apache.torque.criteria.Criteria, TableMap).
+     *                 org.apache.torque.criteria.Criteria).
      *             This method will be removed in a future version of Torque.
      */
     @Deprecated
-    public void correctBooleans(
-            Criteria criteria,
-            TableMap defaultTableMap)
-        throws TorqueException
+    public void correctBooleans(Criteria criteria)
+            throws TorqueException
     {
         for (Object criterionObject : criteria.values())
         {
             Criteria.Criterion criterion = (Criteria.Criterion) criterionObject;
-            correctBooleans(criteria, criterion, defaultTableMap);
+            correctBooleans(criteria, criterion);
        }
     }
 
@@ -2372,8 +2289,7 @@ public class BasePeerImpl<T> implements 
      * @param criteria The criteria to which teh criterion belongs.
      * @param criterion The criterion to be checked for booleanint
      *        and booleanchar columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
+     *
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      *
@@ -2382,20 +2298,19 @@ public class BasePeerImpl<T> implements 
     @Deprecated
     private void correctBooleans(
                 Criteria criteria,
-                Criteria.Criterion criterion,
-                TableMap defaultTableMap)
+                Criteria.Criterion criterion)
             throws TorqueException
     {
         Column column = criterion.getColumn();
-        TableMap tableMap = MapHelper.getTableMap(
+        TableMap tableMapFromCriteria = MapHelper.getTableMap(
                 column,
                 criteria,
-                defaultTableMap);
+                tableMap);
         // if no description of table available, do not modify anything
-        if (tableMap != null)
+        if (tableMapFromCriteria != null)
         {
             String columnName = column.getColumnName();
-            ColumnMap columnMap = tableMap.getColumn(columnName);
+            ColumnMap columnMap = tableMapFromCriteria.getColumn(columnName);
             if (columnMap != null)
             {
                 if ("BOOLEANINT".equals(columnMap.getTorqueType()))
@@ -2413,7 +2328,7 @@ public class BasePeerImpl<T> implements 
         }
         for (Criteria.Criterion attachedCriterion : criterion.getClauses())
         {
-            correctBooleans(criteria, attachedCriterion, defaultTableMap);
+            correctBooleans(criteria, attachedCriterion);
         }
     }
 
@@ -2426,26 +2341,22 @@ public class BasePeerImpl<T> implements 
      *
      * @param criteria The criteria to be checked for booleanint and booleanchar
      *        columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
+     *
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      */
     public void correctBooleans(
-                org.apache.torque.criteria.Criteria criteria,
-                TableMap defaultTableMap)
+                org.apache.torque.criteria.Criteria criteria)
             throws TorqueException
     {
        correctBooleans(
                criteria,
-               criteria.getTopLevelCriterion(),
-               defaultTableMap);
+               criteria.getTopLevelCriterion());
     }
 
     private void correctBooleans(
                 org.apache.torque.criteria.Criteria criteria,
-                org.apache.torque.criteria.Criterion criterion,
-                TableMap defaultTableMap)
+                org.apache.torque.criteria.Criterion criterion)
             throws TorqueException
     {
         if (criterion == null)
@@ -2457,23 +2368,23 @@ public class BasePeerImpl<T> implements 
             for (org.apache.torque.criteria.Criterion part
                     : criterion.getParts())
             {
-                correctBooleans(criteria, part, defaultTableMap);
+                correctBooleans(criteria, part);
             }
             return;
         }
 
         Object possibleColumn = criterion.getLValue();
-        TableMap tableMap = MapHelper.getTableMap(
+        TableMap tableMapForColumn = MapHelper.getTableMap(
                 possibleColumn,
                 criteria,
-                defaultTableMap);
+                tableMap);
         // if no description of table available, do not modify anything
-        if (tableMap == null)
+        if (tableMapForColumn == null)
         {
             return;
         }
         String columnName = ((Column) possibleColumn).getColumnName();
-        ColumnMap columnMap = tableMap.getColumn(columnName);
+        ColumnMap columnMap = tableMapForColumn.getColumn(columnName);
         if (columnMap != null)
         {
             if ("BOOLEANINT".equals(columnMap.getTorqueType()))
@@ -2571,8 +2482,6 @@ public class BasePeerImpl<T> implements 
      *
      * @param columnValues The value to be checked for booleanint
      *        and booleanchar columns.
-     * @param defaultTableMap the table map to be used if the table name is
-     *        not given in a column.
      * @throws TorqueException if the database map for the criteria cannot be
      *         retrieved.
      */
@@ -2580,11 +2489,10 @@ public class BasePeerImpl<T> implements 
             ColumnValues columnValues)
         throws TorqueException
     {
-        TableMap table = columnValues.getTable();
         for (Map.Entry<Column, JdbcTypedValue> entry : columnValues.entrySet())
         {
             String columnName = entry.getKey().getColumnName();
-            ColumnMap column = table.getColumn(columnName);
+            ColumnMap column = getTableMap().getColumn(columnName);
             if (column != null)
             {
                 JdbcTypedValue columnValue = entry.getValue();
@@ -2639,4 +2547,27 @@ public class BasePeerImpl<T> implements 
             crit.setDbName(getDatabaseName());
         }
     }
+
+    /**
+     * Sets the database name in the passed criteria to the table's default,
+     * if it is not already set.
+     *
+     * @param crit the criteria to set the database name in, not null.
+     *
+     * @deprecated Please use addSelectColumns(
+     *                 org.apache.torque.criteria.Criteria).
+     *             This method will be removed in a future version of Torque.
+     */
+    @Deprecated
+    protected void setDbName(Criteria crit) throws TorqueException
+    {
+        if (!Torque.isInit())
+        {
+            throw new TorqueException("Torque is not initialized");
+        }
+        if (crit.getDbName() == null)
+        {
+            crit.setDbName(getDatabaseName());
+        }
+    }
 }

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/ColumnValues.java Mon Aug 20 03:24:18 2012
@@ -34,9 +34,6 @@ import org.apache.torque.map.TableMap;
  */
 public class ColumnValues implements Map<Column, JdbcTypedValue>
 {
-    /** The table to which these column values belong to. */
-    private TableMap table;
-
     /** The column values, keyed by the column names. */
     private Map<Column, JdbcTypedValue> columnValues;
 
@@ -49,24 +46,16 @@ public class ColumnValues implements Map
     /**
      * Constructor with no contained column values.
      *
-     * @param table the table to which these values belong, not null.
-     *
      * @throws NullPointerException if table is null.
      */
-    public ColumnValues(TableMap table)
+    public ColumnValues()
     {
-        if (table == null)
-        {
-            throw new NullPointerException("table must not be null");
-        }
-        this.table = table;
         this.columnValues = new HashMap<Column, JdbcTypedValue>();
     }
 
     /**
      * Constructor with no contained column values.
      *
-     * @param table the table to which these values belong, not null.
      * @param dbName the name of the database handle to use for connection
      *        opening if needed, or null to use the default database handle
      *        for the table.
@@ -75,7 +64,7 @@ public class ColumnValues implements Map
      */
     public ColumnValues(TableMap table, String dbName)
     {
-        this(table);
+        this();
         this.dbName = dbName;
     }
 
@@ -83,19 +72,12 @@ public class ColumnValues implements Map
      * Constructor.
      *
      * @param columnValues the column values, or null.
-     * @param table the table to which these values belong, not null.
      *
      * @throws NullPointerException if table is null.
      */
     public ColumnValues(
-            Map<Column, JdbcTypedValue> columnValues,
-            TableMap table)
+            Map<Column, JdbcTypedValue> columnValues)
     {
-        if (table == null)
-        {
-            throw new NullPointerException("table must not be null");
-        }
-        this.table = table;
         if (columnValues == null)
         {
             this.columnValues = new HashMap<Column, JdbcTypedValue>();
@@ -110,7 +92,6 @@ public class ColumnValues implements Map
      * Constructor.
      *
      * @param columnValues the column values, or null.
-     * @param table the table to which these values belong, not null.
      * @param dbName the name of the database handle to use for connection
      *        opening if needed, or null to use the default database handle
      *        for the table.
@@ -122,21 +103,11 @@ public class ColumnValues implements Map
             TableMap table,
             String dbName)
     {
-        this(columnValues, table);
+        this(columnValues);
         this.dbName = dbName;
     }
 
     /**
-     * Returns the table to which these columns belong to.
-     *
-     * @return the table to which these columns belong to, not null.
-     */
-    public TableMap getTable()
-    {
-        return table;
-    }
-
-    /**
      * Returns the name of the database handle to use for connection
      * opening.
      *
@@ -211,8 +182,7 @@ public class ColumnValues implements Map
     @Override
     public String toString()
     {
-        return "ColumnValues [table=" + table
-            + ", dbName=" + dbName
+        return "ColumnValues [dbName=" + dbName
             + ", columnValues=" + columnValues + "]";
     }
 

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/CountHelper.java Mon Aug 20 03:24:18 2012
@@ -321,11 +321,16 @@ public class CountHelper
         List<Integer> result;
         if (conn == null)
         {
-            result = BasePeer.doSelect(c, new IntegerMapper(), null);
+            result = new BasePeerImpl<Object>().doSelect(
+                    c,
+                    new IntegerMapper());
         }
         else
         {
-            result = BasePeer.doSelect(c, new IntegerMapper(), null, conn);
+            result = new BasePeerImpl<Object>().doSelect(
+                    c,
+                    new IntegerMapper(),
+                    conn);
         }
 
         return result.get(0);
@@ -371,14 +376,17 @@ public class CountHelper
 
         c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));
 
+        BasePeerImpl<?> basePeerImpl = new BasePeerImpl<Object>();
+        basePeerImpl.setTableMap(tableMap);
+
         List<Integer> result;
         if (conn == null)
         {
-            result = BasePeer.doSelect(c, new IntegerMapper(), tableMap);
+            result = basePeerImpl.doSelect(c, new IntegerMapper());
         }
         else
         {
-            result = BasePeer.doSelect(c, new IntegerMapper(), tableMap, conn);
+            result = basePeerImpl.doSelect(c, new IntegerMapper(), conn);
         }
 
         return result.get(0);

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/LargeSelect.java Mon Aug 20 03:24:18 2012
@@ -34,6 +34,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.torque.Torque;
 import org.apache.torque.TorqueException;
+import org.apache.torque.criteria.CriteriaInterface;
 import org.apache.torque.sql.SqlBuilder;
 
 /**
@@ -166,7 +167,7 @@ public class LargeSelect<T> implements R
     private int totalRecords = 0;
 
     /** The criteria used for the query. */
-    private org.apache.torque.criteria.Criteria criteria = null;
+    private CriteriaInterface<?> criteria = null;
 
     /** The last page of results that were returned. */
     private transient List<T> lastResults;
@@ -238,7 +239,7 @@ public class LargeSelect<T> implements R
      * the Criteria object does not contain SELECT columns.
      */
     public LargeSelect(
-            org.apache.torque.criteria.Criteria criteria,
+            CriteriaInterface<?> criteria,
             int pageSize,
             BasePeerImpl<T> peerImpl)
     {
@@ -271,7 +272,7 @@ public class LargeSelect<T> implements R
      * contain SELECT columns..
      */
     public LargeSelect(
-            org.apache.torque.criteria.Criteria criteria,
+            CriteriaInterface<?> criteria,
             int pageSize,
             int memoryPageLimit,
             BasePeerImpl<T> peerImpl)
@@ -546,9 +547,21 @@ public class LargeSelect<T> implements R
              * columns not fully qualified will not be modified.
              */
             String query;
-            peer.correctBooleans(criteria);
-            peer.setDbName(criteria);
-            query = SqlBuilder.buildQuery(criteria).toString();
+            if (criteria instanceof Criteria)
+            {
+                peer.correctBooleans((Criteria) criteria);
+                peer.setDbName((Criteria) criteria);
+                query = SqlBuilder.buildQuery((Criteria) criteria).toString();
+            }
+            else
+            {
+                peer.correctBooleans(
+                        (org.apache.torque.criteria.Criteria) criteria);
+                peer.setDbName((org.apache.torque.criteria.Criteria) criteria);
+                query = SqlBuilder.buildQuery(
+                        (org.apache.torque.criteria.Criteria) criteria)
+                    .toString();
+            }
 
             // Execute the query.
             if (log.isDebugEnabled())
@@ -575,7 +588,19 @@ public class LargeSelect<T> implements R
                     log.debug("run(): Invoking BasePeerImpl.doSelect()");
                 }
 
-                List<T> tempResults = peer.doSelect(criteria, conn);
+                List<T> tempResults;
+                if (criteria instanceof Criteria)
+                {
+                    tempResults = peer.doSelect(
+                            (Criteria) criteria,
+                            conn);
+                }
+                else
+                {
+                    tempResults = peer.doSelect(
+                            (org.apache.torque.criteria.Criteria) criteria,
+                            conn);
+                }
 
                 if (tempResults.size() < criteria.getLimit())
                 {

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/BasePeerImplTest.java Mon Aug 20 03:24:18 2012
@@ -65,6 +65,7 @@ public class BasePeerImplTest extends Ba
     {
         basePeerImpl = new BasePeerImpl();
         super.setUp();
+        basePeerImpl.setTableMap(tableMap);
         MockitoAnnotations.initMocks(this);
         when(connection.prepareStatement((String) any()))
                 .thenReturn(preparedStatement);
@@ -92,7 +93,7 @@ public class BasePeerImplTest extends Ba
         mapper.addMapper(new IntegerMapper(), 1);
 
         List<List<Object>> result = basePeerImpl.doSelect(
-                criteria, mapper, tableMap, connection);
+                criteria, mapper, connection);
 
         // verify mock (verfication order not relevant)
         verify(connection).prepareStatement(
@@ -124,8 +125,7 @@ public class BasePeerImplTest extends Ba
         // no results found
         when(resultSet.next()).thenReturn(false);
 
-        basePeerImpl.doSelect(
-                criteria, new IntegerMapper(), tableMap, connection);
+        basePeerImpl.doSelect(criteria, new IntegerMapper(), connection);
         verify(preparedStatement).setFetchSize(13);
     }
 }

Modified: db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml (original)
+++ db/torque/torque4/trunk/torque-site/src/site/xdoc/migration-from-torque-3.xml Mon Aug 20 03:24:18 2012
@@ -54,10 +54,16 @@
          in the "or" methods (check the javadoc) and treats Strings
          in the first argument as Strings, not as column names 
          (e.g. criteria.and("string1", "string2") has a different meaning in
-         the old and the new Criteria).
+         the old and the new Criteria).<br/>
          Also the new Criteria object does not define the operator 
          Criteria.CUSTOM any more, but instead contains the methods
-         andVerbatimSql() and orVerbatimSql().
+         andVerbatimSql() and orVerbatimSql().<br/>
+         The doDelete(Criteria) and doDelete(Criteria, Connection) methods
+         have a different semantics for the old and the new Criteria object.
+         For the old Criteria object, the table name to delete from is guessed
+         from the Criteria object's contents. For the new Criteria object,
+         the table name is always the table name of the Peer class used to
+         do the delete.
        </li>
        <li>
          Database views are now supported out-of-the-box.

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Mon Aug 20 03:24:18 2012
@@ -186,7 +186,7 @@ torque.om.complexObjectModel.defaultFill
 # can be overridden by setting the baseClass attribute on a table.
 torque.om.dbObjectDefaultBaseClass = 
 # The base class for all Peer classes
-torque.om.basePeerBaseClass = org.apache.torque.util.BasePeer
+torque.om.basePeerBaseClass = 
 # The base class for all Peer implementation classes
 torque.om.basePeerImplBaseClass = org.apache.torque.util.BasePeerImpl
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1374905&r1=1374904&r2=1374905&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Mon Aug 20 03:24:18 2012
@@ -322,6 +322,9 @@
     <mergepoint name="doUpdate">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.doUpdate"/>
     </mergepoint>
+    <mergepoint name="executeStatement">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.executeStatement"/>
+    </mergepoint>
     <mergepoint name="saveMethods">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.saveMethods"/>
     </mergepoint>
@@ -590,6 +593,11 @@
       path="peer/base/doUpdate.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.executeStatement"
+      xsi:type="velocityOutlet"
+      path="peer/base/executeStatement.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.base.saveMethods"
       xsi:type="velocityOutlet"
       path="peer/base/saveMethods.vm">

Modified: 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/base/basePeer.vm?rev=1374905&r1=1374904&r2=1374905&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/base/basePeer.vm Mon Aug 20 03:24:18 2012
@@ -57,6 +57,7 @@ $torqueGen.mergepoint("doSelect")
 $torqueGen.mergepoint("getDbObjectInstance")
 $torqueGen.mergepoint("doInsert")
 $torqueGen.mergepoint("doUpdate")
+$torqueGen.mergepoint("executeStatement")
 #if ($addSaveMethods == "true" && $saveMethodsInDbObjects != "true")
 $torqueGen.mergepoint("saveMethods")
 #end

Modified: 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/base/correctBooleans.vm?rev=1374905&r1=1374904&r2=1374905&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/base/correctBooleans.vm Mon Aug 20 03:24:18 2012
@@ -43,3 +43,23 @@
     {
         ${peerImplGetter}().correctBooleans(criteria);
     }
+
+    /**
+     * Checks all columns in the criteria to see whether
+     * booleanchar and booleanint columns are queried with a boolean.
+     * If yes, the query values are mapped onto values the database
+     * does understand, i.e. 0 and 1 for booleanints and N and Y for
+     * booleanchar columns.
+     *
+     * @param columnValues The value to be checked for booleanint
+     *        and booleanchar columns.
+     * @throws TorqueException if the database map for the criteria cannot be
+     *         retrieved.
+     */
+    public static void correctBooleans(
+            ColumnValues columnValues)
+        throws TorqueException
+    {
+        ${peerImplGetter}().correctBooleans(columnValues);
+    }
+    
\ No newline at end of file



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