John McNally wrote:
> 
> I am going to start checking in these code changes.  I have tested them some
> and they appear to be working, but further testing is needed.  So please
> grab the changes and let me know of problems asap.
> 

--
I tried to send this message last night but it looks like it did not go
through.  If it did go through, sorry for the duplicate.

I found a problem with BasePeer with the transaction stuff that was
added in the following area:
<snip>
        //transaction stuff added for postgres
        if (DBBroker.getInstance().getDB(criteria.getDbName())
                       .objectDataNeedsTrans() &&
                criteria.containsObjectColumn())
        {
</snip>

In my peer class I am setting up my own db/dbmap with the following:
<snip>
        selectCriteria.setDbName(DB_NAME);
        selectCriteria.setMapName(MAP_NAME);
        BasePeer.doUpdate( selectCriteria, criteria );
</snip>

This makes criteria.containsObjectColumn() hurl because is isnt looking
for my map.

So I added a method to Criteria containsObjectColumn(String
databaseMapName) and changed all
of the BasePeer instances of:

criteria.containsObjectColumn() 
to 
critieria.containsObjectColumn(criteria.getMapName())

and it seems to work fine now.  

Here is the patch for BasePeer.java I will send the patch for
Criteria.java in another email.  Let me know
if you want me to apply them.

************ Begin Patch **************
Index: turbine/src/java/org/apache/turbine/om/peer/BasePeer.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/om/peer/BasePeer.java,v
retrieving revision 1.32
diff -u -r1.32 BasePeer.java
--- turbine/src/java/org/apache/turbine/om/peer/BasePeer.java   2000/07/12
12:42:22        1.32
+++ turbine/src/java/org/apache/turbine/om/peer/BasePeer.java   2000/07/12
16:24:05
@@ -56,7 +56,7 @@
  *
  */
 
-// Java Core Classes 
+// Java Core Classes
 import java.util.*;
 import java.sql.*;
 import java.io.*;
@@ -76,7 +76,7 @@
  * Peer classes are responsible for isolating all of the database
  * access for a specific business object.  They execute all of the SQL
  * against the database.  Over time this class has grown to include
- * utility methods which 
+ * utility methods which
  *
  * @author Frank Y. Kim
  * @author John D. McNally
@@ -87,7 +87,7 @@
     /** Constant criteria key to reference ORDER BY columns */
     public static final String ORDER_BY = "ORDER BY";
     /** Constant criteria key to remove Case Information from
search/ordering criteria. */
-    public static final String IGNORE_CASE = "IgNOrE cAsE";     
+    public static final String IGNORE_CASE = "IgNOrE cAsE";
     /** Classes that implement this class should override this value */
     public static final String TABLE_NAME = "TABLE_NAME";
     /** are we in DEBUG mode? */
@@ -96,9 +96,9 @@
     public static final String DEFAULT_MAP_BUILDER =
"org.apache.turbine.util.db.map.TurbineMapBuilder";
     /** hashtable that contains the cached mapBuilders */
     private static Hashtable mapBuilders = new Hashtable(5);
-        
+
     /**
-     * This is a helper method that generates unique ids from a
sequence. It 
+     * This is a helper method that generates unique ids from a
sequence. It
      * is here with this name to be backwards compatible.  Works with
      * Oracle DB, maybe others.
      *
@@ -110,11 +110,11 @@
         DatabaseMap dbMap =
DBBroker.getInstance().getDatabaseMap("default");
         return dbMap.getIDBroker().getNextSequenceIdAsInt(sequence);
     }
+
 
-    
     /**
     * Converts a hashtable to a byte array for storage/serialization.
-    */    
+    */
     public static byte[] hashtableToByteArray( Hashtable hash )
         throws Exception
     {
@@ -122,7 +122,7 @@
         String key = null;
         Object value = null;
         byte[] byteArray = null;
-            
+
         Enumeration keys = hash.keys();
         while(keys.hasMoreElements())
         {
@@ -131,12 +131,12 @@
             if ( value instanceof Serializable )
                 saveData.put ( key, value );
         }
-        
+
         ByteArrayOutputStream baos = null;
         BufferedOutputStream bos = null;
         ObjectOutputStream out = null;
         try
-        {       
+        {
             baos = new ByteArrayOutputStream(); // closed in the
finally
             bos = new BufferedOutputStream(baos); // closed in the
finally
             out = new ObjectOutputStream(bos); // closed in the finally
@@ -184,7 +184,7 @@
         // Log.note("Executing initTableSchema for table: " +
tableName);
         Schema schema = null;
         DBConnection db = null;
- 
+
         try
         {
             if (dbName == null)
@@ -195,14 +195,14 @@
                 // get a connection to the db
                 db = DBBroker.getInstance().getConnection( dbName );
             }
- 
+
             Connection connection = db.getConnection();
- 
+
             schema = new Schema().schema(connection, tableName);
         }
         catch(Exception e)
         {
- 
+
             Log.error(e);
             throw new Error("Error in BasePeer.initTableSchema(" +
tableName + "): " +
                 e.getMessage());
@@ -218,7 +218,7 @@
             }
         }
         return schema;
-    } 
+    }
 
     /**
     * Creates a Column array for a table based on its Schema.
@@ -232,9 +232,9 @@
             int numberOfColumns = schema.numberOfColumns();
             columns = new Column[numberOfColumns];
             for (int i=0; i<numberOfColumns; i++)
-            {          
+            {
                 columns[i] = schema.column(i+1);
-            }             
+            }
         }
         catch(Exception e)
         {
@@ -242,27 +242,27 @@
             throw new Error("Error in BasePeer.initTableColumns(): " +
                 e.getMessage());
         }
-        return columns;   
+        return columns;
     }
 
     /**
     * Convenience method to create a String array of column names.
-    */            
+    */
     public static String[] initColumnNames(Column[] columns)
     {
         String[] columnNames = null;
         columnNames = new String[columns.length];
         for (int i=0; i<columns.length; i++)
-        {          
+        {
             columnNames[i] = columns[i].name();
-        }              
-        return columnNames;   
+        }
+        return columnNames;
     }
-    
+
     /**
     * Convenience method to create a String array of criteria keys. 
Primary use
     * is with TurbineUserPeer.
-    */            
+    */
     public static String[] initCriteriaKeys(String tableName, String[]
columnNames)
     {
         String[] keys = new String[columnNames.length];
@@ -271,7 +271,7 @@
             keys[i] = tableName + "." + columnNames[i].toUpperCase();
         }
         return keys;
-    } 
+    }
 
     /**
      * Method to begin a transaction.
@@ -282,7 +282,7 @@
     {
         DBConnection dbCon = DBBroker.getInstance().getConnection(
dbName );
         dbCon.setAutoCommit(false);
-        return dbCon;        
+        return dbCon;
     }
 
     /**
@@ -326,11 +326,11 @@
     {
         Connection conn = dbCon.getConnection();
         Statement statement = null;
-        
+
         try
         {
             statement = conn.createStatement();
-                    
+
             StringBuffer query = new StringBuffer();
             query.append( "DELETE FROM " )
             .append( table )
@@ -346,7 +346,7 @@
             if (statement != null) statement.close();
         }
     }
-    
+
     /**
      * Convenience method that uses straight JDBC to delete multiple
rows.
      * Village throws an Exception when multiple rows are deleted.
@@ -365,7 +365,7 @@
         {
             // get a connection to the db
             dbCon = DBBroker.getInstance().getConnection();
-            
+
             deleteAll ( dbCon, table, column, value );
         }
         finally
@@ -379,7 +379,7 @@
      */
     public static void doDelete(Criteria criteria) throws Exception
     {
-        DBConnection dbCon = null;        
+        DBConnection dbCon = null;
         try
         {
             // get a connection to the db
@@ -393,7 +393,7 @@
             DBBroker.getInstance().releaseConnection(dbCon);
         }
     }
-            
+
     public static void doDelete(Criteria criteria, DBConnection dbCon)
          throws Exception
     {
@@ -409,7 +409,7 @@
         while(e.hasMoreElements())
         {
             String key = (String)e.nextElement();
-           
tables.add(criteria.getTableName(key));                       
+            tables.add(criteria.getTableName(key));
             if ( criteria.isCascade() )
             {
                 // This steps thru all the columns in the database.
@@ -422,7 +422,7 @@
                         if ( columnMaps[j].isForeignKey()
                             // only delete rows where the foreign key
is also a primary key.
                             // other rows need updated, but that is not
implemented.
-                            && columnMaps[j].isPrimaryKey() 
+                            && columnMaps[j].isPrimaryKey()
                             &&
key.equals(columnMaps[j].getRelatedName()) )
                         {
                             tables.add(tableMaps[i].getName());
@@ -430,9 +430,9 @@
                         }
                     }
                 }
-            } 
+            }
         }
-        
+
         for (int i=0; i<tables.size(); i++)
         {
             KeyDef kd = new KeyDef();
@@ -451,7 +451,7 @@
                 tempDbMap = dbMap;
             }
 
-            ColumnMap[] columnMaps = tempDbMap.getTable( tables.get(i)
).getColumns();  
+            ColumnMap[] columnMaps = tempDbMap.getTable( tables.get(i)
).getColumns();
             for (int j=0; j<columnMaps.length; j++)
             {
                 ColumnMap colMap = columnMaps[j];
@@ -468,15 +468,15 @@
                         whereClause.add( criteria.getString(key) );
                     }
                     else
-                    {   
+                    {
                         whereClause.add( SqlExpression.build(
colMap.getColumnName(),
                             criteria.getValue(key),
                             criteria.getComparison(key),
                             criteria.isIgnoreCase(),
                             db));
                     }
-                }    
-            }           
+                }
+            }
             // execute the statement
             TableDataSet tds = null;
             try
@@ -490,7 +490,7 @@
                     handleMultiple(tds);
                 }
                 for (int j=0; j<tds.size(); j++)
-                {    
+                {
                     Record rec = tds.getRecord(j);
                     rec.markToBeDeleted();
                     rec.save();
@@ -513,7 +513,7 @@
      * be used to insert the row.
      * <br>
      * If no primary key is included in Criteria then we will try
-     * to figure out the primary key from the database map and insert 
+     * to figure out the primary key from the database map and insert
      * the row with the next available id using util.db.IDBroker.
      * <br>
      * If no primary key is defined for the table the values will
@@ -532,8 +532,8 @@
         boolean doTransaction = (DBBroker.getInstance()
                                  .getDB(criteria.getDbName())
                                  .objectDataNeedsTrans() &&
-                                 criteria.containsObjectColumn());
-        
+                                
criteria.containsObjectColumn(criteria.getMapName()));
+
         try
         {
             // get a connection to the db
@@ -558,10 +558,10 @@
                 DBBroker.getInstance().releaseConnection(dbCon);
             }
         }
-        return id;   
+        return id;
     }
+
 
-    
     /**
      * Method to perform inserts based on values and keys in a
Criteria.
      * <p>
@@ -572,7 +572,7 @@
      * be used to insert the row.
      * <br>
      * If no primary key is included in Criteria then we will try
-     * to figure out the primary key from the database map and insert 
+     * to figure out the primary key from the database map and insert
      * the row with the next available id using util.db.IDBroker.
      * <br>
      * If no primary key is defined for the table the values will
@@ -585,7 +585,7 @@
     public static Object doInsert(Criteria criteria, DBConnection
dbCon) throws Exception
     {
         Object id = null;
-        
+
         // get the table name and method for determining the primary
key value
         String tableName = null;
         Enumeration keys = criteria.keys();
@@ -600,7 +600,7 @@
         DatabaseMap dbMap = DBBroker.getInstance().getDatabaseMap(
criteria.getMapName() );
         TableMap tableMap = dbMap.getTable(tableName);
         String keyMethod = tableMap.getPrimaryKeyMethod();
-        
+
         // If the keyMethod is SEQUENCE or IDBROKERTABLE, get the id
before
         // the insert.
         if (keyMethod.equals(TableMap.SEQUENCE))
@@ -612,17 +612,17 @@
         {
             id = dbMap.getIDBroker().getNextId(tableName);
         }
-        // if id was set by a Sequence or IDBroker table, add it to the
criteria 
+        // if id was set by a Sequence or IDBroker table, add it to the
criteria
         if (id != null)
         {
             ColumnMap pk = getPrimaryKey(criteria);
             criteria.add( pk.getFullyQualifiedName(), id );
         }
-        
+
         // set up Village for the insert
         TableDataSet tds = null;
         try
-        {          
+        {
             tds = new TableDataSet(dbCon.getConnection(), tableName );
             Record rec = tds.addRecord();
             insertOrUpdateRecord(rec, tableName, criteria);
@@ -631,7 +631,7 @@
         {
             if (tds != null) tds.close();
         }
-        
+
         // If the primary key column is auto-incremented, get the id
now.
         if (keyMethod.equals(TableMap.AUTOINCREMENT))
         {
@@ -640,8 +640,8 @@
         }
 
         return id;
-    }           
-    
+    }
+
     /**
     * Grouping of code used in both doInsert and doUpdate methods.
     * Sets up a Record for saving.
@@ -662,7 +662,7 @@
         {
             tempDbMap = dbMap;
         }
-        ColumnMap[] columnMaps = tempDbMap.getTable( tableName
).getColumns();  
+        ColumnMap[] columnMaps = tempDbMap.getTable( tableName
).getColumns();
         boolean shouldSave = false;
         for (int j=0; j<columnMaps.length; j++)
         {
@@ -685,10 +685,10 @@
                     rec.setValue( colMap.getColumnName(),
criteria.getFloat(key) );
                 else if ( obj instanceof Double)
                     rec.setValue( colMap.getColumnName(),
criteria.getDouble(key) );
-                else if ( obj instanceof Hashtable ) 
-                    rec.setValue( colMap.getColumnName(),
hashtableToByteArray( (Hashtable)obj ) ); 
+                else if ( obj instanceof Hashtable )
+                    rec.setValue( colMap.getColumnName(),
hashtableToByteArray( (Hashtable)obj ) );
                 shouldSave = true;
-             }    
+             }
         }
         if ( shouldSave )
             rec.save();
@@ -710,12 +710,12 @@
         StringStackBuffer fromClause = querySql.getFromClause();
         StringStackBuffer whereClause = querySql.getWhereClause();
         StringStackBuffer orderByClause = querySql.getOrderByClause();
-        
+
         StringStackBuffer orderBy = criteria.getOrderByColumns();
         boolean ignoreCase = criteria.isIgnoreCase();
         StringStackBuffer select = criteria.getSelectColumns();
         StringStackBuffer modifiers = criteria.getSelectModifiers();
-        
+
         for (int i=0; i<modifiers.size(); i++)
         {
             selectModifiers.add( modifiers.get(i) );
@@ -725,15 +725,15 @@
         {
             String columnName = select.get(i);
             selectClause.add(columnName);
-           
fromClause.add(columnName.substring(0,columnName.indexOf('.')
));           
+           
fromClause.add(columnName.substring(0,columnName.indexOf('.') ));
         }
-        
+
         Enumeration e = criteria.keys();
         while(e.hasMoreElements())
         {
             String key = (String)e.nextElement();
             String table = criteria.getTableName(key);
-            fromClause.add( table ); 
+            fromClause.add( table );
             if ( criteria.getComparison(key).equals(Criteria.CUSTOM) )
             {
                 String custom = criteria.getString(key);
@@ -741,20 +741,20 @@
                     whereClause.add( custom );
             }
             else
-            {   
+            {
                 // Would like to take care of a few simple Sql cases
here
                 // so that they do not have to be specified as CUSTOM
                 boolean ignorCase = criteria.isIgnoreCase()  &&
-                    (dbMap.getTable(table).getColumn(
criteria.getColumnName(key) ).getType() instanceof
String);               
+                    (dbMap.getTable(table).getColumn(
criteria.getColumnName(key) ).getType() instanceof String);
                 whereClause.add( SqlExpression.build( key,
criteria.getValue(key),
                     criteria.getComparison(key), ignorCase, db ));
-         
+
                 // if criteriaColumn is not in the select list, but its
table contains
-                // a foreign key and its relatedKey is in the select
list  
+                // a foreign key and its relatedKey is in the select
list
                 // assume we want a simple join
-                if ( !selectClause.contains(key) ) // what if the
criteria column is in the select list and 
-                                                   // the select list
contains a column from a table which has 
-                                                   // another column
associated a column in criteria column's table 
+                if ( !selectClause.contains(key) ) // what if the
criteria column is in the select list and
+                                                   // the select list
contains a column from a table which has
+                                                   // another column
associated a column in criteria column's table
                 {
                     DatabaseMap tempDbMap = null;
                     try
@@ -771,26 +771,26 @@
                     ColumnMap[] possibleForeignKeys =
tempDbMap.getTable(table).getColumns();
                     for (int i=0; i<possibleForeignKeys.length; i++)
                     {
-                        if ( possibleForeignKeys[i].isForeignKey() 
+                        if ( possibleForeignKeys[i].isForeignKey()
                             &&
selectClause.contains(possibleForeignKeys[i].getRelatedName() ))
                         {
                             ignorCase = criteria.isIgnoreCase()  &&
                                 (possibleForeignKeys[i].getType()
instanceof String);
-                            whereClause.add(
SqlExpression.buildInnerJoin( 
+                            whereClause.add(
SqlExpression.buildInnerJoin(
                                
possibleForeignKeys[i].getFullyQualifiedName(),
                                
possibleForeignKeys[i].getRelatedName(),
                                 ignorCase,
                                 db));
                         }
-                    }                     
+                    }
                 }
                 // more to come ???
             }
-        }        
-        
+        }
+
         if ( orderBy != null && orderBy.size() > 0)
         {
-            // Check for each String/Character column and apply
toUpperCase() 
+            // Check for each String/Character column and apply
toUpperCase()
             for (int i=0; i<orderBy.size(); i++)
             {
                 String orderByColumn = orderBy.get(i);
@@ -798,7 +798,7 @@
                 String columnName = orderByColumn.substring(
orderByColumn.indexOf('.')+1 );
                 ColumnMap column = dbMap.getTable(table).getColumn(
columnName );
                 if (  column.getType() instanceof String )
-                {   
+                {
                     orderByClause.add(
db.ignoreCaseInOrderBy(orderByColumn) );
                 }
                 else
@@ -810,8 +810,8 @@
         if (DEBUG) System.out.println("BasePeer.querySql= "+
querySql.toString());
         return querySql.toString();
     }
- 
- 
+
+
     /**
     * Old method for performing a SELECT.  Returns all results.
     *
@@ -822,7 +822,7 @@
         //transaction stuff added for postgres
         if (DBBroker.getInstance().getDB(criteria.getDbName())
                        .objectDataNeedsTrans() &&
-                criteria.containsObjectColumn())
+                criteria.containsObjectColumn(criteria.getMapName()))
         {
             DBConnection dbCon =
beginTransaction(criteria.getDbName());
             Vector results = executeQuery( createQueryString(criteria),
criteria.getDbName(), criteria.isSingleRecord(), dbCon );
@@ -831,8 +831,8 @@
         }
         else
             return executeQuery( createQueryString(criteria),
criteria.getDbName(), criteria.isSingleRecord() );
-    } 
-    
+    }
+
     /**
     * Old method for performing a SELECT.  Returns all results.
     *
@@ -841,9 +841,9 @@
     public static Vector doSelect(Criteria criteria, DBConnection
dbCon) throws Exception
     {
         return executeQuery( createQueryString(criteria),
criteria.getDbName(), criteria.isSingleRecord(), dbCon );
-    } 
-    
-     
+    }
+
+
     /**
      * Utility method which executes a given sql statement.
      * This method should be used for select statements only.
@@ -857,7 +857,7 @@
     {
         return executeQuery(queryString, "default", false);
     }
-    
+
     /**
      * Utility method which executes a given sql statement.
      * This method should be used for select statements only.
@@ -872,7 +872,7 @@
     {
         return executeQuery(queryString, dbName, false);
     }
-    
+
     /**
     * Method for performing a SELECT.  Returns all results.
     *
@@ -884,9 +884,9 @@
     public static Vector executeQuery(String queryString, String
dbName, boolean singleRecord) throws Exception
     {
         DBConnection db = null;
-        Vector results = null;        
+        Vector results = null;
         try
-        {   
+        {
             // get a connection to the db
             db = DBBroker.getInstance().getConnection( dbName );
             // execute the query
@@ -907,15 +907,15 @@
     * @param boolean whether or not we want to select only a single
record.
     * @return Vector of Record objects.
     */
-    public static Vector executeQuery(String queryString, String
dbName, 
+    public static Vector executeQuery(String queryString, String
dbName,
         boolean singleRecord, DBConnection dbCon) throws Exception
     {
         Connection connection = dbCon.getConnection();
-    
+
         QueryDataSet qds = null;
         Vector results = new Vector();
         try
-        {   
+        {
             // execute the query
             qds = new QueryDataSet( connection, queryString );
             results = getSelectResults( qds, -1, singleRecord);
@@ -926,8 +926,8 @@
         }
         return results;
     }
+
 
-    
     /**
     * Returns all records in a QueryDataSet as a Vector of Record
objects.
     * Used for functionality like util.db.LargeSelect.
@@ -936,7 +936,7 @@
     */
     public static Vector getSelectResults( QueryDataSet qds )
         throws Exception
-    {       
+    {
         return getSelectResults( qds, 0, -1, false);
     }
 
@@ -949,7 +949,7 @@
     */
     public static Vector getSelectResults( QueryDataSet qds, boolean
singleRecord )
         throws Exception
-    {       
+    {
         return getSelectResults( qds, 0, -1, singleRecord);
     }
 
@@ -963,7 +963,7 @@
     */
     public static Vector getSelectResults( QueryDataSet qds, int
numberOfResults, boolean singleRecord )
         throws Exception
-    {       
+    {
         if (numberOfResults == 0)
             return null;
         return getSelectResults( qds, 0, numberOfResults,
singleRecord);
@@ -989,7 +989,7 @@
         }
         else
         {
-            results = new Vector(numberOfResults); 
+            results = new Vector(numberOfResults);
             qds.fetchRecords(start, numberOfResults);
         }
         if ( qds.size() > 1 && singleRecord )
@@ -1005,7 +1005,7 @@
         }
         return results;
     }
-    
+
     /**
      * Helper method which returns the primary key contained
      * in the given Criteria object.
@@ -1018,10 +1018,10 @@
     {
         // assume all the keys are for the same table
         String key = (String)criteria.keys().nextElement();
-        
+
         String table = criteria.getTableName(key);
         ColumnMap pk = null;
-       
+
         if ( !table.equals("") )
         {
             DatabaseMap dbMap =
DBBroker.getInstance().getDatabaseMap(criteria.getMapName());
@@ -1031,7 +1031,7 @@
                 throw new Exception ("dbMap.getTable() is null");
 
             ColumnMap[] columns = dbMap.getTable(table).getColumns();
-            
+
             for (int i=0; i<columns.length; i++)
             {
                 if ( columns[i].isPrimaryKey() )
@@ -1043,15 +1043,15 @@
         }
         return pk;
     }
-    
+
     /**
-    * Use this method for performing an update 
+    * Use this method for performing an update
     * "WHERE primary_key_id = an int"
     * <p>
     * Convenience method used to update rows in the DB.  Checks
-    * if a <i>single</i> int primary key is specified in the Criteria 
-    * object and uses it to perform the udpate.  If no primary key 
-    * is specified an Exception will be thrown.  
+    * if a <i>single</i> int primary key is specified in the Criteria
+    * object and uses it to perform the udpate.  If no primary key
+    * is specified an Exception will be thrown.
     * <p>
     * To perform an update with non-primary key fields in the WHERE
     * clause use doUpdate(criteria, criteria).
@@ -1064,7 +1064,7 @@
         boolean doTransaction = (DBBroker.getInstance()
                                  .getDB(updateValues.getDbName())
                                  .objectDataNeedsTrans() &&
-                                 updateValues.containsObjectColumn());
+                                
updateValues.containsObjectColumn(updateValues.getMapName()));
         DBConnection db = null;
         try
         {
@@ -1073,7 +1073,7 @@
                 db = beginTransaction(updateValues.getDbName());
             else
                 db = DBBroker.getInstance().getConnection(
updateValues.getDbName() );
-            
+
             doUpdate(updateValues, db);
         }
         finally
@@ -1084,16 +1084,16 @@
                 DBBroker.getInstance().releaseConnection(db);
         }
     }
-    
-    
+
+
     /**
-    * Use this method for performing an update 
+    * Use this method for performing an update
     * "WHERE primary_key_id = an int"
     * <p>
     * Convenience method used to update rows in the DB.  Checks
-    * if a <i>single</i> int primary key is specified in the Criteria 
-    * object and uses it to perform the udpate.  If no primary key 
-    * is specified an Exception will be thrown.  
+    * if a <i>single</i> int primary key is specified in the Criteria
+    * object and uses it to perform the udpate.  If no primary key
+    * is specified an Exception will be thrown.
     * <p>
     * To perform an update with non-primary key fields in the WHERE
     * clause use doUpdate(criteria, criteria).
@@ -1105,7 +1105,7 @@
     {
         ColumnMap pk = getPrimaryKey(updateValues);
         Criteria selectCriteria = null;
-        
+
         if ( pk != null &&
              updateValues.containsKey(pk.getFullyQualifiedName()) )
         {
@@ -1117,12 +1117,12 @@
         {
             throw new Exception("BasePeer.doUpdate(criteria) - no PK
specified");
         }
-        
+
         doUpdate( selectCriteria, updateValues, dbCon );
     }
-    
+
     /**
-    * Use this method for performing an update 
+    * Use this method for performing an update
     * "WHERE some_column = some value<br>
     *  AND could_have_another_column = another value"<br>
     * and so on.
@@ -1139,7 +1139,7 @@
         boolean doTransaction = (DBBroker.getInstance()
                                  .getDB(updateValues.getDbName())
                                  .objectDataNeedsTrans() &&
-                                 updateValues.containsObjectColumn());
+                                
updateValues.containsObjectColumn(selectCriteria.getMapName()));
         DBConnection db = null;
         try
         {
@@ -1148,7 +1148,7 @@
                 db = beginTransaction(selectCriteria.getDbName());
             else
                 db = DBBroker.getInstance().getConnection(
selectCriteria.getDbName() );
-            
+
             doUpdate(selectCriteria, updateValues, db);
         }
         finally
@@ -1162,7 +1162,7 @@
 
 
     /**
-    * Use this method for performing an update 
+    * Use this method for performing an update
     * "WHERE some_column = some value<br>
     *  AND could_have_another_column = another value"<br>
     * and so on.
@@ -1173,14 +1173,14 @@
     * @param Criteria object containing values used in where clause.
     * @param Criteria object containing values used in set clause.
     */
-    public static void doUpdate(Criteria selectCriteria, Criteria
updateValues, 
+    public static void doUpdate(Criteria selectCriteria, Criteria
updateValues,
         DBConnection dbCon)  throws Exception
     {
         DB db = DBBroker.getInstance().getDB(
selectCriteria.getDbName() );
         DatabaseMap dbMap = DBBroker.getInstance().getDatabaseMap(
selectCriteria.getMapName() );
         Connection connection = dbCon.getConnection();
-        
-        // set up a list of required tables 
+
+        // set up a list of required tables
         // StringStackBuffer.add() only adds element if it is unique.
         StringStackBuffer tables = new StringStackBuffer();
         Enumeration e = selectCriteria.keys();
@@ -1188,7 +1188,7 @@
         {
             tables.add(selectCriteria.getTableName(
(String)e.nextElement() ));
         }
-        
+
         for (int i=0; i<tables.size(); i++)
         {
             KeyDef kd = new KeyDef();
@@ -1222,16 +1222,16 @@
                         whereClause.add( selectCriteria.getString( key
));
                     }
                     else
-                    {   
+                    {
                         whereClause.add( SqlExpression.build(
colMap.getColumnName(),
                             selectCriteria.getValue( key ),
                             selectCriteria.getComparison( key ),
                             selectCriteria.isIgnoreCase(),
                             db ));
                     }
-                }    
+                }
             }
-            TableDataSet tds = null;            
+            TableDataSet tds = null;
             try
             {
                 // get affected records
@@ -1245,7 +1245,7 @@
                     handleMultiple(tds);
                 }
                 for (int j=0; j<tds.size(); j++)
-                {    
+                {
                     Record rec = tds.getRecord(j);
                     insertOrUpdateRecord(rec, tables.get(i),
updateValues);
                 }
@@ -1259,7 +1259,7 @@
 
     /**
      * Utility method which executes a given sql statement.
-     * This method should be used for update, insert, and 
+     * This method should be used for update, insert, and
      * delete statements.  Use executeQuery() for selects.
      *
      * @param String sql statement to execute.
@@ -1268,10 +1268,10 @@
     {
         return executeStatement(stmt, "default");
     }
-    
+
     /**
      * Utility method which executes a given sql statement.
-     * This method should be used for update, insert, and 
+     * This method should be used for update, insert, and
      * delete statements.  Use executeQuery() for selects.
      *
      * @param String sql statement to execute.
@@ -1280,12 +1280,12 @@
     public static int executeStatement(String stmt, String dbName)
throws Exception
     {
         DBConnection db = null;
-        int rowCount = -1;        
+        int rowCount = -1;
         try
         {
             // get a connection to the db
             db = DBBroker.getInstance().getConnection( dbName );
-            
+
             rowCount = executeStatement( stmt, dbName, db );
         }
         finally
@@ -1298,7 +1298,7 @@
 
     /**
      * Utility method which executes a given sql statement.
-     * This method should be used for update, insert, and 
+     * This method should be used for update, insert, and
      * delete statements.  Use executeQuery() for selects.
      *
      * @param String sql statement to execute.
@@ -1310,7 +1310,7 @@
         Connection con = dbCon.getConnection();
         Statement statement = null;
         int rowCount = -1;
-        
+
         try
         {
             statement = con.createStatement();
@@ -1326,28 +1326,28 @@
 
     /**
      * If the user specified that she only wants to retrieve
-     * a single record and multiple records are retrieved this 
+     * a single record and multiple records are retrieved this
      * method is called to handle the situation.  Subclasses
      * can override this method as needed.
      */
     protected static void handleMultiple(DataSet ds) throws Exception
-    {    
+    {
         throw new Exception("Criteria expected single Record and
Multiple Records were selected.");
     }
-    
+
     /**
-     * This method returns the MapBuilder specified in the 
+     * This method returns the MapBuilder specified in the
      * TurbineResources.properties file. By default, this is
      * org.apache.turbine.util.db.map.TurbineMapBuilder.
      */
     public static MapBuilder getMapBuilder()
     {
-        return
getMapBuilder(TurbineResources.getString("database.maps.builder", 
+        return
getMapBuilder(TurbineResources.getString("database.maps.builder",
                 DEFAULT_MAP_BUILDER).trim());
     }
 
     /**
-     * This method returns the MapBuilder specified in the 
+     * This method returns the MapBuilder specified in the
      * name parameter. You should pass in the full path to the
      * class, ie: org.apache.turbine.util.db.map.TurbineMapBuilder
      * the MapBuilder instances are cached in this class for speed.
@@ -1355,7 +1355,7 @@
      */
     public static MapBuilder getMapBuilder(String name)
     {
-        try 
+        try
         {
             MapBuilder mb = null;
             if ( ! mapBuilders.containsKey(name) )
@@ -1380,6 +1380,6 @@
             // initialization of Peers.  Log the exception and return
null.
             Log.error("BasePeer.MapBuilder failed trying to
instantiate: " + name, e);
         }
-        return null; 
+        return null;
     }
 }
************ End Patch ****************

********************************
** John Thorhauer
** [EMAIL PROTECTED]
********************************


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to