<p>
deleteCascades.
</p>

@param entity
a {@link java.lang.Object} object.
514896
public void deleteCascades(Object entity) {
		if (entity != null) {
			List<Field> fields = ClassUtil.getAnnotatedFields(entity.getClass(), Reference.class);
			for (Field field : fields) {
				Cascade[] cascades = ClassUtil.getFieldAnnotationValue("cascade", field, Reference.class, Cascade[].class);
				if (Arrays.asList(cascades).contains(Cascade.DELETE)) {
					Object referencedEntity = ClassUtil.getValueOfField(field, entity);
					if(referencedEntity != null){
						try {
							apitraryDaoSupport.resolveApitraryEntityId(referencedEntity);
							apitraryDaoSupport.delete(referencedEntity);
						} catch (ApitraryOrmIdException aoie) {
							/*
							 * TODO find better way for exception without breaking th cascade flow
							 */
							log.warn(aoie);
						}
					}
				}
			}
		}
	}
478894
protected function deleteEntity($entity)
    {
        $this->checkEntityType($entity);

        $delete = new Delete($this->aggregate($entity), $this->newQueryBuilder());

        $delete->execute();
    }
828301
@Override
	public void delete(Object entity) {
		if (entity == null) {
			throw new IllegalArgumentException("'entity' must not be [" + entity + "]");
		}
		
		assertTransactional();
		List<Log> logs = transaction.get().logs();
		
		if (logs.isEmpty()) {
			throw new IllegalStateException("Log ["
					+ Log.Operation.DELETE
					+ "] is not allowed: previous operation must be ["
					+ Log.Operation.GET + "]");
		}
		
		for (int i = logs.size() - 1; i >= 0; i--) {
			Log log = logs.get(i);
			
			if (keyValue(entity).equals(keyValue(log.entity()))) {
				if (log.operation() == Log.Operation.GET) {
					break;
				} else {
					throw new IllegalStateException("Log [" + log.operation() 
							+ "] -> [" + Log.Operation.DELETE
							+ "] is not allowed: previous operation must be ["
							+ Log.Operation.GET + "]");
				}
			}
		}
		
		Transaction tx = transaction.get().transaction();
		List<Key> keys = new ArrayList<Key>();
		
		for (Entity e : Translation.toEntities(entity)) {
			keys.add(e.getKey());
		}
		
		datastore.delete(tx, keys);
		Log log = new Log(logs.size() + 1, Log.Operation.DELETE, entity);
		log.state(State.UNCOMMITTED);
		logs.add(log);
	}
28361
public int deleteCascade(Metadata metadata) throws SQLException {
		int count = 0;

		if (metadata != null) {

			// Delete Metadata References and remove parent references
			MetadataReferenceDao dao = getMetadataReferenceDao();
			dao.deleteByMetadata(metadata.getId());
			dao.removeMetadataParent(metadata.getId());

			// Delete
			count = delete(metadata);
		}
		return count;
	}
839356
public void remove(Object e)
    {
        // Invoke Pre Remove Events

        // TODO Check for validity also as per JPA
        if (e == null)
        {
            throw new IllegalArgumentException("Entity to be removed must not be null.");
        }

        EntityMetadata metadata = getMetadata(e.getClass());

        // Create an object graph of the entity object
        ObjectGraph graph = new GraphGenerator().generateGraph(e, this, new ManagedState());

        Node node = graph.getHeadNode();

        try
        {
            lock.writeLock().lock();

            // TODO : push into action queue, get original end-point from
            // persistenceContext first!

            // Action/ExecutionQueue/ActivityQueue :-> id, name, EndPoint,
            // changed
            // state

            // Change state of node, after successful flush processing.
            node.setPersistenceDelegator(this);
            node.remove();

            // build flush stack.

            flushManager.buildFlushStack(node, EventType.DELETE);

            // Flush node.
            flush();
        }
        finally
        {
            lock.writeLock().unlock();
        }
        // clear out graph
        graph.clear();
        graph = null;

        if (log.isDebugEnabled())
        {
            log.debug("Data removed successfully for entity : " + e.getClass());
        }
    }
398865
@Override
    public void delete(T entity) {
        Assert.notNull(entity, "entity to be deleted should not be null");

        final String partitionKeyValue = information.getPartitionKeyFieldValue(entity);

        operation.deleteById(information.getCollectionName(),
                information.getId(entity),
                partitionKeyValue == null ? null : new PartitionKey(partitionKeyValue));
    }
1046713
@Override
    protected void delete(Object entity, Object pKey)
    {

        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                .getMetamodel(entityMetadata.getPersistenceUnit());
        EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());

        KuduSession session = kuduClient.newSession();
        KuduTable table = null;
        try
        {
            table = kuduClient.openTable(entityMetadata.getTableName());
        }
        catch (Exception e)
        {
            logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
            throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
        }
        Delete delete = table.newDelete();
        PartialRow row = delete.getRow();
        String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getName();

        Field field = (Field) entityType.getAttribute(idColumnName).getJavaMember();
        Object value = PropertyAccessorHelper.getObject(entity, field);
        Type idType = KuduDBValidationClassMapper.getValidTypeForClass(field.getType());

        if (entityType.getAttribute(idColumnName).getJavaType().isAnnotationPresent(Embeddable.class))
        {
            // Composite Id
            EmbeddableType embeddableIdType = metaModel.embeddable(entityType.getAttribute(idColumnName).getJavaType());
            Field[] fields = entityType.getAttribute(idColumnName).getJavaType().getDeclaredFields();
            addPrimaryKeyToRow(row, embeddableIdType, fields, metaModel, value);
        }
        else
        {
            // Simple Id
            KuduDBDataHandler.addToRow(row, ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(),
                    value, idType);
        }

        try
        {
            session.apply(delete);
        }
        catch (Exception e)
        {
            logger.error("Cannot delete row from table : " + entityMetadata.getTableName(), e);
            throw new KunderaException("Cannot delete row from table : " + entityMetadata.getTableName(), e);
        }
        finally
        {
            try
            {
                session.close();
            }
            catch (Exception e)
            {
                logger.error("Cannot close session", e);
                throw new KunderaException("Cannot close session", e);
            }
        }
    }
1140701
@Override
    public void detach(Object entity) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "em.detach(" + entity + ");\n" + toString());

        getEMInvocationInfo(false).detach(entity);
    }
335863
public int deleteByIdCascade(String id, boolean userTable)
			throws SQLException {
		int count = 0;
		if (id != null) {
			Contents contents = queryForId(id);
			if (contents != null) {
				count = deleteCascade(contents, userTable);
			} else if (userTable) {
				dropTable(id);
			}
		}
		return count;
	}
872342
public function delete($entity)
    {
        $this->_em->remove($entity);
        $this->_em->flush($entity);
    }
1344052
@Override
    protected void delete(Object entity, Object pKey)
    {
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
        r.db(entityMetadata.getSchema()).table(entityMetadata.getTableName()).get(pKey).delete().run(connection);
    }
488384
@Override
    public Iterable<T> delete(final Iterable<T> entities) {
        return inTransaction(new Callable<Iterable<T>>() {
            @Override
            public Iterable<T> call() throws Exception {
                for (T object : entities) {
                    T attached = getAttached(object);
                    if (attached != null) {
                        entityManager.remove(attached);
                    }
                }
                return entities;
            }
        });
    }
129883
public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasException {
       RequestContext requestContext = RequestContext.get();

       Set<AtlasVertex> deletionCandidateVertices = new HashSet<>();

       for (AtlasVertex instanceVertex : instanceVertices) {
            String guid = GraphHelper.getGuid(instanceVertex);
            Id.EntityState state = GraphHelper.getState(instanceVertex);
            if (requestContext.getDeletedEntityIds().contains(guid) || state == Id.EntityState.DELETED) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Skipping deletion of {} as it is already deleted", guid);
                }

                continue;
            }

           // Get GUIDs and vertices for all deletion candidates.
           Set<VertexInfo> compositeVertices = graphHelper.getCompositeVertices(instanceVertex);

           // Record all deletion candidate GUIDs in RequestContext
           // and gather deletion candidate vertices.
           for (VertexInfo vertexInfo : compositeVertices) {
               requestContext.recordEntityDelete(vertexInfo.getGuid(), vertexInfo.getTypeName());
               deletionCandidateVertices.add(vertexInfo.getVertex());
           }
       }

       // Delete traits and vertices.
       for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) {
           deleteAllTraits(deletionCandidateVertex);
           deleteTypeVertex(deletionCandidateVertex, false);
       }
    }
750078
public int deleteByIdCascade(Long id) throws SQLException {
		int count = 0;
		if (id != null) {
			SpatialReferenceSystem srs = queryForId(id);
			if (srs != null) {
				count = deleteCascade(srs);
			}
		}
		return count;
	}
271844
@Override
    public void delete(Object entity, Object pKey)
    {
        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                metadata.getPersistenceUnit());
        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(metadata.getEntityClazz());
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();
        secondaryTables.add(metadata.getTableName());
        if (metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType()))
        {
            pKey = KunderaCoreUtils.prepareCompositeKey(metadata, pKey);
        }

        for (String colTableName : secondaryTables)
        {
            deleteByColumn(metadata.getSchema(), colTableName,
                    ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(), pKey);
        }

    }
300101
public void deleteEntry(GoogleEntry entry, GoogleCalendar calendar) throws IOException {
        dao.events().delete(calendar.getId(), entry.getId()).execute();
    }
725196
public int deleteCascade(TableIndex tableIndex) throws SQLException {
		int count = 0;

		if (tableIndex != null) {

			// Delete Geometry Indices
			GeometryIndexDao geometryIndexDao = getGeometryIndexDao();
			if (geometryIndexDao.isTableExists()) {
				DeleteBuilder<GeometryIndex, GeometryIndexKey> db = geometryIndexDao
						.deleteBuilder();
				db.where().eq(GeometryIndex.COLUMN_TABLE_NAME,
						tableIndex.getTableName());
				PreparedDelete<GeometryIndex> deleteQuery = db.prepare();
				geometryIndexDao.delete(deleteQuery);
			}

			count = delete(tableIndex);
		}
		return count;
	}