Replace insane implementation with one that does not rely on the database to magically know in which order we want results returned.

This commit is contained in:
Par Winzell
2007-08-22 20:30:20 +00:00
parent fa316d40d1
commit be3649908b
@@ -124,11 +124,16 @@ public abstract class FindAllQuery<T extends PersistentRecord>
// and execute it
try {
ResultSet rs = stmt.executeQuery();
for (Key<T> key : fetchKeys) {
if (!rs.next()) {
throw new SQLException("Expecting more rows in result set.");
}
entities.put(key, _marsh.createObject(rs));
int cnt = 0;
while (rs.next()) {
T obj = _marsh.createObject(rs);
entities.put(_marsh.getPrimaryKey(obj), obj);
cnt ++;
}
if (cnt != fetchKeys.size()) {
throw new SQLException(
"Row count mismatch in second pass [expectedCount=" + fetchKeys.size() +
", actualCount=" + cnt + "]");
}
} finally {