code: public <T> T detach(Class<T> clazz, Object id) {
          pm.getFetchPlan().setDetachmentOptions(FetchPlan.DETACH_LOAD_FIELDS);
          return pm.detachCopy(pm.getObjectById(clazz, id));
      }
docs: Refreshes and detaches an object by its ID.
  @param <T> A type parameter. This type will be returned
  @param clazz the persistence class to retrive the ID for
  @param id the object id to retrieve
  @return an object of the specified type
  @since 1.3.0