From 610b03df80a414f0124c708587fd292c0df46a87 Mon Sep 17 00:00:00 2001 From: samskivert Date: Fri, 12 Sep 2008 01:55:54 +0000 Subject: [PATCH] Ah, entities.keySet() is misleading because it contains records that were found in the cache as well as records loaded from earlier passes in cases where we split our query up to avoid database breaking in() clause sizes. Now we track exactly what we got this time around and report that. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2417 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/jdbc/depot/FindAllQuery.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/java/com/samskivert/jdbc/depot/FindAllQuery.java b/src/java/com/samskivert/jdbc/depot/FindAllQuery.java index 9965b70e..30e6ba62 100644 --- a/src/java/com/samskivert/jdbc/depot/FindAllQuery.java +++ b/src/java/com/samskivert/jdbc/depot/FindAllQuery.java @@ -269,19 +269,21 @@ public abstract class FindAllQuery new KeySet(_type, keys))); PreparedStatement stmt = _builder.prepare(conn); try { + Set> got = new HashSet>(); ResultSet rs = stmt.executeQuery(); int cnt = 0, dups = 0; while (rs.next()) { T obj = _marsh.createObject(rs); - if (entities.put(_marsh.getPrimaryKey(obj), obj) != null) { + Key key = _marsh.getPrimaryKey(obj); + if (entities.put(key, obj) != null) { dups++; } + got.add(key); cnt++; } if (cnt != keys.size()) { - log.warning("Row count mismatch in second pass [origQuery=" + origStmt + - ", wanted=" + keys + ", got=" + entities.keySet() + - ", dups=" + dups + "]", new Exception()); + log.warning("Row count mismatch in second pass", "origQuery", origStmt, + "wanted", keys, "got", got, "dups", dups, new Exception()); } } finally {