From 04d7fedb92a43b34c65a0e3851102ed00fbe20e3 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 29 May 2009 19:12:44 +0000 Subject: [PATCH] Boop boop. Final methods with Comparable nixed. The javadocs for DepotRepository are looking positively svelt and comprehensible. --- .../com/samskivert/depot/DepotRepository.java | 47 ------------------- .../depot/tests/TestRepository.java | 2 +- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/java/com/samskivert/depot/DepotRepository.java b/src/java/com/samskivert/depot/DepotRepository.java index 83e627f..2d2ac57 100644 --- a/src/java/com/samskivert/depot/DepotRepository.java +++ b/src/java/com/samskivert/depot/DepotRepository.java @@ -552,53 +552,6 @@ public abstract class DepotRepository }); } - /** - * Updates the specified columns for all persistent objects matching the supplied primary key. - * - * @param type the type of the persistent object to be modified. - * @param primaryKey the primary key to match in the update. - * @param updates an mapping from the columns to the values to be assigned. - * - * @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, Comparable primaryKey, Map updates) - throws DatabaseException - { - Object[] fieldsValues = new Object[updates.size()*2]; - int idx = 0; - for (Map.Entry entry : updates.entrySet()) { - fieldsValues[idx++] = entry.getKey(); - fieldsValues[idx++] = entry.getValue(); - } - return updatePartial(type, primaryKey, fieldsValues); - } - - /** - * Updates the specified columns for all persistent objects matching the supplied primary key. - * - * @param type the type of the persistent object to be modified. - * @param primaryKey the primary key to match in the update. - * @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, Comparable primaryKey, Object... fieldsValues) - throws DatabaseException - { - return updatePartial(_ctx.getMarshaller(type).makePrimaryKey(primaryKey), fieldsValues); - } - /** * Updates the specified columns for all persistent objects matching the supplied key. * diff --git a/src/java/com/samskivert/depot/tests/TestRepository.java b/src/java/com/samskivert/depot/tests/TestRepository.java index 70ec552..e4ab3ce 100644 --- a/src/java/com/samskivert/depot/tests/TestRepository.java +++ b/src/java/com/samskivert/depot/tests/TestRepository.java @@ -97,7 +97,7 @@ public class TestRepository extends DepotRepository // record.numbers = new int[] { 1, 2, 3, 4, 5 }; // repo.update(record, TestRecord.AGE, TestRecord.NAME, TestRecord.NUMBERS); - repo.updatePartial(TestRecord.class, record.recordId, + repo.updatePartial(TestRecord.getKey(record.recordId), TestRecord.AGE, 25, TestRecord.NAME, "Bob", TestRecord.NUMBERS, new int[] { 1, 2, 3, 4, 5 }); System.out.println("Updated " + repo.load(TestRecord.getKey(record.recordId)));