((UnitOfWorkImpl)session).getCascadeDeleteObjects().add(object);
}
}
for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) {
Object wrappedObject = cp.nextEntry(iter, session);
DeleteObjectQuery deleteQuery = new DeleteObjectQuery();
deleteQuery.setIsExecutionClone(true);
Map extraData = null;
if (this.listOrderField != null) {
extraData = new DatabaseRecord(1);
extraData.put(this.listOrderField, index++);
}
prepareModifyQueryForDelete(query, deleteQuery, wrappedObject, extraData);
session.executeQuery(deleteQuery, deleteQuery.getTranslationRow());
cp.propogatePreDelete(query, wrappedObject);
}
if (!session.isUnitOfWork()) {
// This deletes any objects on the database, as the collection in memory may has been changed.
// This is not required for unit of work, as the update would have already deleted these objects,