From 00d6ae549230489d3d0de1796bcb3d7736cea60d Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 8 Sep 2008 19:01:30 +0000 Subject: [PATCH] Don't try to do the primary key lookup on delete for records that define no primary key. --- .../com/samskivert/jdbc/depot/DepotRepository.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/java/com/samskivert/jdbc/depot/DepotRepository.java b/src/java/com/samskivert/jdbc/depot/DepotRepository.java index f2bdc73..d6fa9f3 100644 --- a/src/java/com/samskivert/jdbc/depot/DepotRepository.java +++ b/src/java/com/samskivert/jdbc/depot/DepotRepository.java @@ -821,9 +821,15 @@ public abstract class DepotRepository protected int deleteAll (Class type, final WhereClause where) throws DatabaseException { - // look up the primary keys for all rows matching our where clause and delete using those - KeySet pwhere = new KeySet(type, findAllKeys(type, true, where)); - return deleteAll(type, pwhere, pwhere); + if (_ctx.getMarshaller(type).hasPrimaryKey()) { + // look up the primary keys for all rows matching our where clause and delete using those + KeySet pwhere = new KeySet(type, findAllKeys(type, true, where)); + return deleteAll(type, pwhere, pwhere); + } else { + // otherwise just do the delete directly as we can't have cached a record that has no + // primary key in the first place + return deleteAll(type, where, null); + } } /**