/** * 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(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException { Object objects = this.readPrivateOwnedForObject(query); // delete all these objects one by one ContainerPolicy cp = this.getContainerPolicy(); for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) { query.getSession().deleteObject(cp.next(iter, query.getSession())); } }
/** * 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(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException { Object objects = this.readPrivateOwnedForObject(query); // delete all these objects one by one ContainerPolicy cp = this.getContainerPolicy(); for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) { query.getSession().deleteObject(cp.next(iter, query.getSession())); } }
/** * 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(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException { Object objects = this.readPrivateOwnedForObject(query); // delete all these objects one by one ContainerPolicy cp = this.getContainerPolicy(); for (Object iter = cp.iteratorFor(objects); cp.hasNext(iter);) { query.getSession().deleteObject(cp.next(iter, query.getSession())); } }
/** * INTERNAL: * Update the reference objects. */ public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (isForeignKeyRelationship()) { return; } if (!this.shouldObjectModifyCascadeToParts(query)) { return; } // if the target objects are not instantiated, they could not have been changed.... if (!this.isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } // manage objects added and removed from the collection Object objectsInMemory = this.getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); Object objectsInDB = this.readPrivateOwnedForObject(query); this.compareObjectsAndWrite(objectsInDB, objectsInMemory, query); }
/** * INTERNAL: * Update the privately owned parts. */ public void preUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (!this.isForeignKeyRelationship()) { return; } if (!this.shouldObjectModifyCascadeToParts(query)) { return; } // if the target objects are not instantiated, they could not have been changed.... if (!this.isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } // manage objects added and removed from the collection Object objectsInMemory = this.getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); Object objectsInDB = this.readPrivateOwnedForObject(query); this.compareObjectsAndWrite(objectsInDB, objectsInMemory, query); }