diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java b/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java index df398334..5dc9d55d 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java @@ -54,8 +54,8 @@ public abstract class JORARepository extends SimpleRepository } /** - * Updates the specified field in the supplied object which must - * correspond to the supplied table. + * Updates the specified field in the supplied object (which must + * correspond to the supplied table). */ protected void updateField ( final Table table, final Object object, String field) @@ -73,6 +73,28 @@ public abstract class JORARepository extends SimpleRepository }); } + /** + * Updates the specified fields in the supplied object (which must + * correspond to the supplied table). + */ + protected void updateFields ( + final Table table, final Object object, String[] fields) + throws PersistenceException + { + final FieldMask mask = table.getFieldMask(); + for (int ii = 0; ii < fields.length; ii++) { + mask.setModified(fields[ii]); + } + execute(new Operation() { + public Object invoke (Connection conn, DatabaseLiaison liaison) + throws SQLException, PersistenceException + { + table.update(object, mask); + return null; + } + }); + } + /** * After the database session is begun, this function will be called * to give the repository implementation the opportunity to create its