/** * INTERNAL: * Return the value of an attribute which this mapping represents for an object. */ public Object getAttributeValueFromObject(Object object) throws DescriptorException { try { return getAttributeAccessor().getAttributeValueFromObject(object); } catch (DescriptorException exception) { exception.setMapping(this); throw exception; } }
/** * Delete all the reference objects with a single query. */ protected void deleteAll(WriteObjectQuery query) throws DatabaseException { Object referenceObjects = null; if(usesIndirection()) { Object attribute = getAttributeAccessor().getAttributeValueFromObject(query.getObject()); if(attribute == null || (ClassConstants.IndirectContainer_Class.isAssignableFrom(attribute.getClass()) && !((IndirectContainer)attribute).isInstantiated())) { // An empty Vector indicates to DeleteAllQuery that no objects should be removed from cache referenceObjects = new Vector(0); } } if(referenceObjects == null) { referenceObjects = this.getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); } ((DeleteAllQuery)this.getDeleteAllQuery()).executeDeleteAll(query.getSession().getSessionForClass(this.getReferenceClass()), query.getTranslationRow(), this.getContainerPolicy().vectorFor(referenceObjects, query.getSession())); }
/** * To delete all the entries matching the selection criteria from the table stored in the * referenced descriptor */ protected void deleteAll(WriteObjectQuery query) throws DatabaseException { Object referenceObjects = null; if(usesIndirection()) { Object attribute = getAttributeAccessor().getAttributeValueFromObject(query.getObject()); if(attribute == null || !((ValueHolderInterface)attribute).isInstantiated()) { // An empty Vector indicates to DeleteAllQuery that no objects should be removed from cache referenceObjects = new Vector(0); } } if(referenceObjects == null) { referenceObjects = this.getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); } // Ensure that the query is prepare before cloning. ((DeleteAllQuery)getDeleteAllQuery()).executeDeleteAll(query.getSession().getSessionForClass(getReferenceClass()), query.getTranslationRow(), getContainerPolicy().vectorFor(referenceObjects, query.getSession())); }