You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2006/02/17 20:25:07 UTC

svn commit: r378599 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform: PlatformImplBase.java SqlBuilder.java

Author: tomdz
Date: Fri Feb 17 11:25:07 2006
New Revision: 378599

URL: http://svn.apache.org/viewcvs?rev=378599&view=rev
Log:
Fix for DDLUTILS-72 as supplied by Vignesh Swaminathan

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=378599&r1=378598&r2=378599&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Fri Feb 17 11:25:07 2006
@@ -1281,6 +1281,8 @@
         Table   table        = model.findTable(dynaClass.getTableName());
         HashMap columnValues = toColumnValues(properties, bean);
 
+        columnValues.putAll(toColumnValues(primaryKeys, bean));
+
         return _builder.getUpdateSql(table, columnValues, bean == null);
     }
 
@@ -1333,7 +1335,7 @@
             {
                 setObject(statement, sqlIndex++, dynaBean, properties[idx]);
             }
-            for (int idx = 0; idx < properties.length; idx++)
+            for (int idx = 0; idx < primaryKeys.length; idx++)
             {
                 setObject(statement, sqlIndex++, dynaBean, primaryKeys[idx]);
             }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=378599&r1=378598&r2=378599&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java Fri Feb 17 11:25:07 2006
@@ -791,8 +791,9 @@
      * update statement usable in a prepared statement is build.
      * 
      * @param table           The table
-     * @param columnValues    Contains the primary key values to identify the object to update
-     *                        and the values for the columns to update
+     * @param columnValues    Contains the values for the columns to update, and should also
+     *                        contain the primary key values to identify the object to update
+     *                        in case <code>genPlaceholders</code> is <code>false</code> 
      * @param genPlaceholders Whether to generate value placeholders for a
      *                        prepared statement (both for the pk values and the object values)
      * @return The update sql