Remove the given entity from the persistence context, causing a managed
entity to become detached.
344173
public void detach(Object entity)
    {
        Node node = getPersistenceCache().getMainCache().getNodeFromCache(entity, getMetadata(entity.getClass()), this);
        if (node != null)
        {
            node.detach();
        }
    }
131017
@Override
	public synchronized void removeContext(Context context) {

        if( log.isDebugEnabled() )
            log.debug("Removing context[" + context.getPath() + "]");

        boolean isContextExists = isContextExists(context);
        if(!isContextExists)
        	return;
        
        // Remove this Context from the associated Host
        if( log.isDebugEnabled() )
            log.debug(" Removing this Context");
        context.getParent().removeChild(context);

    }
1332997
public static function remove() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "remove"), func_get_args());
	}
183153
protected <T> void remove(Class<T> entityClass, Object id)
    {
        remove(entityClass, id, Boolean.TRUE);
    }
1058539
private void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException
    {
        //logger.info("DELETING " + obj);
        // object is not null
        if (obj != null)
        {
            obj = getProxyFactory().getRealObject(obj);
            /**
             * Kuali Foundation modification -- 8/24/2007
             */
            if ( obj == null ) return;
            /**
             * End of Kuali Foundation modification
             */
            /**
             * MBAIRD
             * 1. if we are marked for delete already, avoid recursing on this object
             *
             * arminw:
             * use object instead Identity object in markedForDelete List,
             * because using objects we get a better performance. I can't find
             * side-effects in doing so.
             */
            if (markedForDelete.contains(obj))
            {
                return;
            }
            
            ClassDescriptor cld = getClassDescriptor(obj.getClass());
            //BRJ: check for valid pk
            if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj))
            {
                String msg = "Cannot delete object without valid PKs. " + obj;
                logger.error(msg);
                return;
            }
            
            /**
             * MBAIRD
             * 2. register object in markedForDelete map.
             */
            markedForDelete.add(obj);
            Identity oid = serviceIdentity().buildIdentity(cld, obj);

            // Invoke events on PersistenceBrokerAware instances and listeners
            BEFORE_DELETE_EVENT.setTarget(obj);
            fireBrokerEvent(BEFORE_DELETE_EVENT);
            BEFORE_DELETE_EVENT.setTarget(null);

            // now perform deletion
            performDeletion(cld, obj, oid, ignoreReferences);
 	  	 
            // Invoke events on PersistenceBrokerAware instances and listeners
            AFTER_DELETE_EVENT.setTarget(obj);
            fireBrokerEvent(AFTER_DELETE_EVENT);
            AFTER_DELETE_EVENT.setTarget(null);
 	  	 	
            // let the connection manager to execute batch
            connectionManager.executeBatchIfNecessary();
        }
    }
496473
public void removeAttachment(IAtomBase toRemove) throws CTKException {

    Map<String, IAtomBase> groups = getRgroups();
    for (String key : groups.keySet()) {

      if (groups.get(key).compare(toRemove)) {
        for (int i = 0; i < attachments.size(); i++) {
          if (attachments.get(i).getLabel().equals(key)) {
            attachments.remove(i);
            break;
          }
        }
      }
    }
  }
341238
@Override
    public void unregisterObject(Object object) {
        if (object instanceof IContextEvent) {
            for (IManagedContext<?> managedContext : managedContexts) {
                managedContext.removeSubscriber((IContextEvent) object);
            }
        }

        if (object instanceof IManagedContext) {
            managedContexts.remove(object);
        }
    }
1214477
def remove_entity_layer(self):
        
        if self.entity_layer is not None:
            this_node = self.entity_layer.get_node()
            self.root.remove(this_node)
            self.entity_layer = None
        if self.header is not None:
            self.header.remove_lp('entities')
695725
public void removeEm(String sessionToken)
    {
        if (emMap != null)
        {
            EntityManager em = emMap.get(sessionToken);
            if (em != null)
            {
                em.close();
            }
            emMap.remove(sessionToken);
        }
    }
335561
@Override
    public void delete(Object entity, Object pKey)
    {
        if (!isOpen())
        {
            throw new PersistenceException("ThriftClient is closed.");
        }

        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
        Connection conn = null;
        try
        {
            conn = getConnection();
            MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                    metadata.getPersistenceUnit());

            AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(metadata.getEntityClazz());
            // For secondary tables.
            List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                    .getSecondaryTablesName();
            secondaryTables.add(metadata.getTableName());

            for (String tableName : secondaryTables)
            {
                if (isCql3Enabled(metadata))
                {
                    String deleteQuery = onDeleteQuery(metadata, tableName, metaModel, pKey);
                    executeCQLQuery(deleteQuery, isCql3Enabled(metadata));

                }
                else
                {
                    if (metadata.isCounterColumnType())
                    {
                        deleteRecordFromCounterColumnFamily(pKey, tableName, metadata, getConsistencyLevel());
                    }
                    else
                    {
                        ColumnPath path = new ColumnPath(tableName);

                        conn.getClient().remove(
                                CassandraUtilities.toBytes(pKey, metadata.getIdAttribute().getJavaType()), path,
                                generator.getTimestamp(), getConsistencyLevel());
                    }
                }
            }
            getIndexManager().remove(metadata, entity, pKey);

            // Delete from Inverted Index if applicable
            invertedIndexHandler.delete(entity, metadata, getConsistencyLevel(), kunderaMetadata);
        }
        catch (InvalidRequestException e)
        {
            log.error("Error while deleting of column family {} for row key {}, Caused by: .", metadata.getTableName(),
                    pKey, e);
            throw new KunderaException(e);
        }
        catch (TException e)
        {
            log.error("Error while deleting of column family {} for row key {}, Caused by: .", metadata.getTableName(),
                    pKey, e);
            throw new KunderaException(e);
        }
        finally
        {
            releaseConnection(conn);
        }
    }
875259
public function removeEntity(Entity $entity)
    {
        foreach ($this->entities as $key => $entityElement) {
            if ($entityElement === $entity) {
                unset($this->entities[$key]);
                break;
            }
        }

        return $this;
    }
276319
public <T> void evict(T entity) {
        DocumentInfo documentInfo = documentsByEntity.get(entity);
        if (documentInfo != null) {
            documentsByEntity.remove(entity);
            documentsById.remove(documentInfo.getId());
        }

        deletedEntities.remove(entity);
        if (_countersByDocId != null) {
            _countersByDocId.remove(documentInfo.getId());
        }
    }
202655
public function remove(EntityRemoved $event)
    {
        $entity = $event->getEntity();
        $collection = $event->getCollection();
        $this->deleteRelation($entity, $collection);
    }
1298234
function(entities, options) {
      var removed = [];
      for (var i = 0; i < entities.length; i++) {
        var entity = this.get(entities[i]);
        if (!entity) continue;

        var index = this.indexOf(entity);
        this.entities.splice(index, 1);
        this.length--;

        // Remove references before triggering 'remove' event to prevent an
        // infinite loop. #3693
        delete this._byId[entity.cid];
        var id = this.entityId(entity.attributes);
        if (id != null) delete this._byId[id];

        if (!options.silent) {
          options.index = index;
          entity.trigger('remove', entity, this, options);
        }

        removed.push(entity);
        this._removeReference(entity, options);
      }
      return removed;
    }
629516
def destroy_entitiy(self, entity):
        
        for relation in self._database.values():
            relation.pop(entity, None)
        for l in self._entities_by_component.values():
            l.discard(entity)
        self._entities.remove(entity)
367887
@Override
	public void delete(final T entity) {
		String id = null;
		try {
			id = (String) arangoOperations.getConverter().getMappingContext().getPersistentEntity(domainClass)
					.getIdProperty().getField().get(entity);
		} catch (final IllegalAccessException e) {
			e.printStackTrace();
		}
		arangoOperations.delete(id, domainClass);
	}
1019011
@Override
  public <T> T remove(Object objectToRemove, Class<T> entityClass) {
    return remove(objectToRemove, Util.determineCollectionName(entityClass));
  }