From 830e83010001a905f8271d3e46197ab43a5c32a2 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 10 Mar 2009 23:30:36 +0000 Subject: [PATCH] Nixed these two updatePartial() convenience methods because they are dangerous. The "key" (which identifies the rows you want to change) was [ColumnExp, Comparable, ...] and the data that you would be changing was [ColumnExp, Object]. So if you happened to pass a comparable object as the first value you wanted to change, say: updatePartial(FooRecord.class, FooRecord.FOO_ID, 5, FooRecord.BAR_ID, 6, FooRecord.BAZ, "biffle") the compiler would think you wanted to use FOO_ID and BAR_ID as a key rather than FOO_ID as a key and BAR_ID as something to be updated. Either way, it's not clear what you want, so it should go. Now you have to create a Key(): updatePartial(new Key(FooRecord.clsas, FooRecord.FOO_ID, 5, FooRecord.BAR_ID, 6), FooRecord.BAZ, "biffle") or updatePartial(new Key(FooRecord.clsas, FooRecord.FOO_ID, 5), FooRecord.BAR_ID, 6, FooRecord.BAZ, "biffle") None of our code was doing this anyway. We were already using Key everywhere or the (Class, Comparable) method for records with a single column as primary key. --- .../com/samskivert/depot/DepotRepository.java | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/src/java/com/samskivert/depot/DepotRepository.java b/src/java/com/samskivert/depot/DepotRepository.java index e3f5250..57d6b10 100644 --- a/src/java/com/samskivert/depot/DepotRepository.java +++ b/src/java/com/samskivert/depot/DepotRepository.java @@ -633,50 +633,6 @@ public abstract class DepotRepository return updatePartial(_ctx.getMarshaller(type).makePrimaryKey(primaryKey), fieldsValues); } - /** - * Updates the specified columns for all persistent objects matching the supplied two-column - * primary key. - * - * @param type the type of the persistent object to be modified. - * @param fieldsValues an array containing the columns (as ColumnExp) and the values to be - * assigned, in key, value, key, value, etc. order. - * - * @return the number of rows modified by this action. - * - * @throws DuplicateKeyException if the update attempts to change the key columns of a row to - * values that duplicate another row already in the database. - * @throws DatabaseException if any problem is encountered communicating with the database. - */ - protected int updatePartial ( - Class type, ColumnExp ix1, Comparable val1, ColumnExp ix2, Comparable val2, - Object... fieldsValues) - throws DatabaseException - { - return updatePartial(new Key(type, ix1, val1, ix2, val2), fieldsValues); - } - - /** - * Updates the specified columns for all persistent objects matching the supplied three-column - * primary key. - * - * @param type the type of the persistent object to be modified. - * @param fieldsValues an array containing the columns (as ColumnExp) and the values to be - * assigned, in key, value, key, value, etc. order. - * - * @return the number of rows modified by this action. - * - * @throws DuplicateKeyException if the update attempts to change the key columns of a row to - * values that duplicate another row already in the database. - * @throws DatabaseException if any problem is encountered communicating with the database. - */ - protected int updatePartial ( - Class type, ColumnExp ix1, Comparable val1, ColumnExp ix2, Comparable val2, - ColumnExp ix3, Comparable val3, Object... fieldsValues) - throws DatabaseException - { - return updatePartial(new Key(type, ix1, val1, ix2, val2, ix3, val3), fieldsValues); - } - /** * Updates the specified columns for all persistent objects matching the supplied key. *