From ffa1f10e6b84f7c5a86c2bb38a1556ad214c1fca Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 23 May 2007 18:20:08 +0000 Subject: [PATCH] Oops, we were using _result to pass the record into the modifier in the first place. We'll continue to do that and clear out _result during invoke() which is a wee bit clearer anyway. --- src/java/com/samskivert/jdbc/depot/DepotRepository.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/jdbc/depot/DepotRepository.java b/src/java/com/samskivert/jdbc/depot/DepotRepository.java index b29a621..9aa77bb 100644 --- a/src/java/com/samskivert/jdbc/depot/DepotRepository.java +++ b/src/java/com/samskivert/jdbc/depot/DepotRepository.java @@ -284,10 +284,11 @@ public class DepotRepository if (key == null) { throw new IllegalArgumentException("Can't update record with null primary key."); } - // by passing null as "result" we flush the record from the cache and don't restore it - return _ctx.invoke(new CachingModifier(null, key, key) { + return _ctx.invoke(new CachingModifier(record, key, key) { public int invoke (Connection conn) throws SQLException { PreparedStatement stmt = marsh.createUpdate(conn, _result, key, modifiedFields); + // clear out _result so that we don't rewrite this partial record to the cache + _result = null; try { return stmt.executeUpdate(); } finally {