}
int count = 1;
// bind the identity of the preparedStatement
if (identity.size() != ids.length) {
throw new PersistenceException("Size of identity field mismatched!");
}
for (int i = 0; i < ids.length; i++) {
stmt.setObject(count++, ids[i].toSQL(identity.get(i)));
}
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.format("jdo.removing", _type, stmt.toString()));
}
int result = stmt.executeUpdate();
if (result < 1) {
throw new PersistenceException("Object to be deleted does not exist! " + identity);
}
// Must delete record in parent table last.
// All other dependents have been deleted before.
if (extended != null) {
extended.delete(conn, identity);
}
} catch (SQLException except) {
LOG.fatal(Messages.format("jdo.deleteFatal", _type, _statement), except);
throw new PersistenceException(Messages.format("persist.nested", except), except);
} finally {
try {
if (stmt != null) { stmt.close(); }
} catch (Exception e) {
LOG.warn("Problem closing JDBC statement", e);