Don't try to do the primary key lookup on delete for records that define no

primary key.
This commit is contained in:
Michael Bayne
2008-09-08 19:01:30 +00:00
parent ffeb6534c4
commit 00d6ae5492
@@ -821,9 +821,15 @@ public abstract class DepotRepository
protected <T extends PersistentRecord> int deleteAll (Class<T> type, final WhereClause where)
throws DatabaseException
{
// look up the primary keys for all rows matching our where clause and delete using those
KeySet<T> pwhere = new KeySet<T>(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<T> pwhere = new KeySet<T>(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);
}
}
/**