code: @Override
      public void detach(Object entity)
      {
          checkClosed();
  
          if (entity == null)
          {
              throw new IllegalArgumentException("Entity is null, can't detach it.");
          }
          getPersistenceDelegator().detach(entity);
      }
docs: Remove the given entity from the persistence context, causing a managed
  entity to become detached. Unflushed changes made to the entity if any
  (including removal of the entity), will not be synchronized to the
  database. Entities which previously referenced the detached entity will
  continue to reference it.
  
  @param entity
  @throws IllegalArgumentException
  if the instance is not an entity
  @see javax.persistence.EntityManager#detach(java.lang.Object)