Ejemplo n.º 1
0
  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());
  }
Ejemplo n.º 2
0
  public void copy(FetchConfiguration fetch) {
    setFetchBatchSize(fetch.getFetchBatchSize());
    setMaxFetchDepth(fetch.getMaxFetchDepth());
    setQueryCacheEnabled(fetch.getQueryCacheEnabled());
    setFlushBeforeQueries(fetch.getFlushBeforeQueries());
    setExtendedPathLookup(fetch.getExtendedPathLookup());
    setLockTimeout(fetch.getLockTimeout());
    setQueryTimeout(fetch.getQueryTimeout());
    setLockScope(fetch.getLockScope());
    clearFetchGroups();
    addFetchGroups(fetch.getFetchGroups());
    clearFields();
    copyHints(fetch);
    setCacheRetrieveMode(fetch.getCacheRetrieveMode());
    setCacheStoreMode(fetch.getCacheStoreMode());
    addFields(fetch.getFields());

    // don't use setters because require active transaction
    _state.readLockLevel = fetch.getReadLockLevel();
    _state.writeLockLevel = fetch.getWriteLockLevel();
  }
Ejemplo n.º 3
0
 public FetchConfiguration resetFetchGroups() {
   clearFetchGroups();
   if (_state.ctx != null)
     addFetchGroups(Arrays.asList(_state.ctx.getConfiguration().getFetchGroupsList()));
   return this;
 }