From 4ef11efe2062e467c80bf79f7e4effa7513618dd Mon Sep 17 00:00:00 2001 From: mdb Date: Thu, 23 Sep 2004 16:53:03 +0000 Subject: [PATCH] A very handy method. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1505 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/jdbc/JORARepository.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java b/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java index 371403b0..df398334 100644 --- a/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java +++ b/projects/samskivert/src/java/com/samskivert/jdbc/JORARepository.java @@ -22,6 +22,7 @@ package com.samskivert.jdbc; import java.sql.*; +import com.samskivert.io.PersistenceException; import com.samskivert.jdbc.jora.*; /** @@ -52,6 +53,26 @@ public abstract class JORARepository extends SimpleRepository createTables(_session); } + /** + * 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) + throws PersistenceException + { + final FieldMask mask = table.getFieldMask(); + mask.setModified(field); + 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