code: public void detach(Object entity)
      {
          Node node = getPersistenceCache().getMainCache().getNodeFromCache(entity, getMetadata(entity.getClass()), this);
          if (node != null)
          {
              node.detach();
          }
      }
docs: Remove the given entity from the persistence context, causing a managed
  entity to become detached.