/** * 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(DeleteObjectQuery 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())); } }
/** * 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(DeleteObjectQuery 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())); } }
/** * 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(DeleteObjectQuery 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())); } }
/** * INTERNAL: * Update the privately owned parts */ public void postUpdate(WriteObjectQuery writeQuery) throws DatabaseException, OptimisticLockException { if (isReadOnly()) { return; } // If objects are not instantiated that means they are not changed. if (!isAttributeValueInstantiatedOrChanged(writeQuery.getObject())) { return; } // Manage objects added and removed from the collection. Object objects = getRealCollectionAttributeValueFromObject(writeQuery.getObject(), writeQuery.getSession()); Object currentObjectsInDB = readPrivateOwnedForObject(writeQuery); if (currentObjectsInDB == null) { currentObjectsInDB = getContainerPolicy().containerInstance(1); } compareObjectsAndWrite(currentObjectsInDB, objects, writeQuery); }