/** Clone this instance. */
 public Object clone() {
   FetchConfigurationImpl clone = newInstance(null);
   clone._state.ctx = _state.ctx;
   clone._parent = _parent;
   clone._fromField = _fromField;
   clone._fromType = _fromType;
   clone._directRelationOwner = _directRelationOwner;
   clone._load = _load;
   clone._availableRecursion = _availableRecursion;
   clone._availableDepth = _availableDepth;
   clone.copy(this);
   return clone;
 }
  public void setContext(StoreContext ctx) {
    // can't reset non-null context to another context
    if (ctx != null && _state.ctx != null && ctx != _state.ctx) throw new InternalException();
    _state.ctx = ctx;
    if (ctx == null) return;

    // initialize to conf info
    OpenJPAConfiguration conf = ctx.getConfiguration();
    setFetchBatchSize(conf.getFetchBatchSize());
    setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
    setLockTimeout(conf.getLockTimeout());
    setQueryTimeout(conf.getQueryTimeout());
    clearFetchGroups();
    addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
    setMaxFetchDepth(conf.getMaxFetchDepth());
  }