/** * PUBLIC: * delete all of the objects and all of their privately owned parts in the database. * The allows for a group of objects to be deleted as a unit. * The objects will be deleted through a single transactions. * * @exception DatabaseException if an error occurs on the database, * these include constraint violations, security violations and general database erros. * @exception OptimisticLockException if the object's descriptor is using optimistic locking and * the object has been updated or deleted by another user since it was last read. */ public void deleteAllObjects(Collection domainObjects) throws DatabaseException, OptimisticLockException { for (Iterator objectsEnum = domainObjects.iterator(); objectsEnum.hasNext();) { deleteObject(objectsEnum.next()); } }
/** * PUBLIC: * delete all of the objects and all of their privately owned parts in the database. * The allows for a group of objects to be deleted as a unit. * The objects will be deleted through a single transactions. * * @exception DatabaseException if an error occurs on the database, * these include constraint violations, security violations and general database erros. * @exception OptimisticLockException if the object's descriptor is using optimistic locking and * the object has been updated or deleted by another user since it was last read. */ public void deleteAllObjects(Vector domainObjects) throws DatabaseException, OptimisticLockException { for (Enumeration objectsEnum = domainObjects.elements(); objectsEnum.hasMoreElements();) { deleteObject(objectsEnum.nextElement()); } }
for (Enumeration objectsToDeleteEnum = objects.elements(); objectsToDeleteEnum.hasMoreElements();) { getSession().deleteObject(objectsToDeleteEnum.nextElement());
/** * This method will make sure that all the records privately owned by this mapping are * actually removed. If such records are found then those are all read and removed one * by one along with their privately owned parts. */ protected void deleteReferenceObjectsLeftOnDatabase(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { Object objects = this.readPrivateOwnedForObject(query); // Delete all these object one by one. ContainerPolicy cp = this.getContainerPolicy(); for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) { query.getSession().deleteObject(cp.next(iter, query.getSession())); } }
/** * Verifying deletes make sure that all the records privately owned by this mapping are * actually removed. If such records are found than those are all read and removed one * by one taking their privately owned parts into account. */ protected void verifyDeleteForUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { Object objects = readPrivateOwnedForObject(query); // Delete all these object one by one. ContainerPolicy cp = getContainerPolicy(); for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) { query.getSession().deleteObject(cp.next(iter, query.getSession())); } }
for (Enumeration objectsToDeleteEnum = objects.elements(); objectsToDeleteEnum.hasMoreElements();) { getSession().deleteObject(objectsToDeleteEnum.nextElement());
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted) throws DatabaseException, OptimisticLockException { if (isPrivateOwned()) {// Must check ownership for uow and cascading. if (query.shouldCascadeOnlyDependentParts()) { // If the session is a unit of work if (query.getSession().isUnitOfWork()) { // ...and the object has not been explictly deleted in the unit of work if (!(((UnitOfWorkImpl)query.getSession()).getDeletedObjects().containsKey(objectDeleted))) { query.getSession().getCommitManager().addObjectToDelete(objectDeleted); } } else { query.getSession().getCommitManager().addObjectToDelete(objectDeleted); } } else { query.getSession().deleteObject(objectDeleted); } } }
query.getSession().getCommitManager().addObjectToDelete(objectInDatabase); } else { query.getSession().deleteObject(objectInDatabase);