From 98ac644ad9525f8569b47d2e2b1e3664537ad8cd Mon Sep 17 00:00:00 2001 From: Michael Bayne 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. --- 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 9965b70..30e6ba6 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 {